aboutsummaryrefslogtreecommitdiffstats
path: root/community/openblas/0001-Use-strsignal-instead-of-sys_siglist.patch
blob: 6032fc01732036bbb21372cfa718f9ff0d48d42d (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
From 518435f376fb7b1a1972ea44cd932f1314f34cbf Mon Sep 17 00:00:00 2001
From: Isaac Dunham <ibid.ag@gmail.com>
Date: Sat, 26 Mar 2016 21:37:36 -0700
Subject: [PATCH] Use strsignal() instead of sys_siglist[].

musl libc only implements strsignal().
POSIX 2008 requires strsignal() but not sys_siglist[], and glibc,
the BSDs, Solaris, and OS X support both.
I'm not sure about the status on mingw; as far as I can tell, they
define strsignal(x) as sys_siglist[x].

Also use snprintf() because it's not strictly guaranteed that signal
descriptions be any particular length.
I'm not aware of any signal descriptions over 114 bytes long, so this
is mostly paranoia.
---
 utest/ctest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utest/ctest.h b/utest/ctest.h
index a62103f..1deea32 100644
--- a/utest/ctest.h
+++ b/utest/ctest.h
@@ -637,7 +637,7 @@ static void *find_symbol(struct ctest *test, const char *fname)
 static void sighandler(int signum)
 {
     char msg[128];
-    sprintf(msg, "[SIGNAL %d: %s]", signum, sys_siglist[signum]);
+    snprintf(msg, sizeof(msg), "[SIGNAL %d: %s]", signum, strsignal(signum));
     color_print(ANSI_BRED, msg);
     fflush(stdout);
 
-- 
2.7.4