120-sigprocmask-invalid-call.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 56893a61aa4f0270fa8d1197b9848247f90fce0d 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. The POSIX document says
  6. The pthread_sigmask() and sigprocmask() functions shall fail if:
  7. [EINVAL]
  8. The value of the how argument is not equal to one of the defined values.
  9. and this is how musl-libc is currently doing. Fix the call to be safe
  10. and correct
  11. [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
  12. gdb/ChangeLog:
  13. 2017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
  14. * common/signals-state-save-restore.c (save_original_signals_state):
  15. Fix invalid sigprocmask call.
  16. ---
  17. gdb/ChangeLog | 5 +++++
  18. gdb/common/signals-state-save-restore.c | 2 +-
  19. 2 files changed, 6 insertions(+), 1 deletion(-)
  20. --- a/gdb/common/signals-state-save-restore.c
  21. +++ b/gdb/common/signals-state-save-restore.c
  22. @@ -41,7 +41,7 @@ save_original_signals_state (bool quiet)
  23. int i;
  24. int res;
  25. - res = sigprocmask (0, NULL, &original_signal_mask);
  26. + res = sigprocmask (SIG_BLOCK, NULL, &original_signal_mask);
  27. if (res == -1)
  28. perror_with_name (("sigprocmask"));