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