gdb: fix invalid sigprocmask call
[openwrt/staging/mkresin.git] / package / devel / gdb / patches / 120-sigprocmask-invalid-call.patch
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 diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
29 index d11a9ae..734335c 100644
30 --- a/gdb/common/signals-state-save-restore.c
31 +++ b/gdb/common/signals-state-save-restore.c
32 @@ -41,7 +41,7 @@ save_original_signals_state (void)
33 int i;
34 int res;
35
36 - res = sigprocmask (0, NULL, &original_signal_mask);
37 + res = sigprocmask (SIG_BLOCK, NULL, &original_signal_mask);
38 if (res == -1)
39 perror_with_name (("sigprocmask"));
40
41 --
42 2.6.4
43