blob: 0796c34c76bc0daacc41ecfca03569f028028895 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 56893a61aa4f0270fa8d1197b9848247f90fce0d Mon Sep 17 00:00:00 2001
2From: Yousong Zhou <yszhou4tech@gmail.com>
3Date: Fri, 24 Mar 2017 10:36:03 +0800
4Subject: [PATCH] Fix invalid sigprocmask call
5
6The 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
13and this is how musl-libc is currently doing. Fix the call to be safe
14and correct
15
16 [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
17
18gdb/ChangeLog:
192017-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