summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gdb/gdb/0011-Fix-invalid-sigprocmask-call.patch
blob: bce025c391d6c30f345985ecaad646219bc5be61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From b1985595e46721bb168ac38f4c841a915cc2f799 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 24 Mar 2017 10:36:03 +0800
Subject: [PATCH 11/11] Fix invalid sigprocmask call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.

Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek]
Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 gdb/common/signals-state-save-restore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
index 5bb66321bb..6597decbc6 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 (bool quiet)
   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.18.0