0007-Fix-invalid-sigprocmask-call.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 696891f6c5a1c6acab95dffd8c1d3a986ca71a18 Mon Sep 17 00:00:00 2001
  2. From: Yousong Zhou <yszhou4tech@gmail.com>
  3. Date: Fri, 24 Mar 2017 10:36:03 +0800
  4. Subject: [PATCH] Fix invalid sigprocmask call
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The POSIX document says
  9. The pthread_sigmask() and sigprocmask() functions shall fail if:
  10. [EINVAL]
  11. The value of the how argument is not equal to one of the defined values.
  12. and this is how musl-libc is currently doing. Fix the call to be safe
  13. and correct
  14. [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
  15. gdb/ChangeLog:
  16. 2017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
  17. * common/signals-state-save-restore.c (save_original_signals_state):
  18. Fix invalid sigprocmask call.
  19. Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek]
  20. Signed-off-by: André Draszik <adraszik@tycoint.com>
  21. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  22. ---
  23. gdbsupport/signals-state-save-restore.cc | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc
  26. index 3ec7a259c9c..0702eca7725 100644
  27. --- a/gdbsupport/signals-state-save-restore.cc
  28. +++ b/gdbsupport/signals-state-save-restore.cc
  29. @@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
  30. int i;
  31. int res;
  32. - res = gdb_sigmask (0, NULL, &original_signal_mask);
  33. + res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask);
  34. if (res == -1)
  35. perror_with_name (("sigprocmask"));