This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix invalid sigprocmask call
- From: Yousong Zhou <yszhou4tech at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: Yousong Zhou <yszhou4tech at gmail dot com>
- Date: Fri, 24 Mar 2017 11:01:59 +0800
- Subject: [PATCH] Fix invalid sigprocmask call
- Authentication-results: sourceware.org; auth=none
The POSIX document says
The pthread_sigmask() and sigprocmask() functions shall fail if:
[EINVAL]
The value of the how argument is not equal to one of the defined values.
and this is how musl-libc is currently doing. Fix the call to be safe
and correct
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
gdb/ChangeLog:
2017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
* common/signals-state-save-restore.c (save_original_signals_state):
Fix invalid sigprocmask call.
---
gdb/ChangeLog | 5 +++++
gdb/common/signals-state-save-restore.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ad7ac3..fc2c57b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
+
+ * common/signals-state-save-restore.c (save_original_signals_state):
+ Fix invalid sigprocmask call.
+
2017-03-23 Simon Marchi <simon.marchi@ericsson.com>
* fbsd-tdep.c (fbsd_corefile_thread): Don't set/restore
diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
index d11a9ae..734335c 100644
--- a/gdb/common/signals-state-save-restore.c
+++ b/gdb/common/signals-state-save-restore.c
@@ -41,7 +41,7 @@ save_original_signals_state (void)
int i;
int res;
- res = sigprocmask (0, NULL, &original_signal_mask);
+ res = sigprocmask (SIG_BLOCK, NULL, &original_signal_mask);
if (res == -1)
perror_with_name (("sigprocmask"));
--
2.6.4