summaryrefslogtreecommitdiff
path: root/security/sudo/patches/patch-lib_util_str2sig.c
blob: 49a26d449acd80267849d62a6d7d204456fbcd17 (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
$NetBSD: patch-lib_util_str2sig.c,v 1.2 2019/10/16 20:25:21 maya Exp $

Handle sysconf(_SC_RTSIG_MAX) not existing (netbsd):
just assume the static limits is good enough.

--- lib/util/str2sig.c.orig	2019-10-10 16:33:03.000000000 +0000
+++ lib/util/str2sig.c
@@ -112,7 +112,11 @@ sudo_str2sig(const char *signame, int *r
 	}
 	if (signame[5] == '+') {
 	    if (isdigit((unsigned char)signame[6])) {
+#ifdef _SC_RTSIG_MAX
 		const long rtmax = sysconf(_SC_RTSIG_MAX);
+#else
+		const long rtmax = SIGRTMAX - SIGRTMIN;
+#endif
 		const int off = signame[6] - '0';
 
 		if (rtmax > 0 && off < rtmax / 2) {
@@ -131,7 +135,11 @@ sudo_str2sig(const char *signame, int *r
 	}
 	if (signame[5] == '-') {
 	    if (isdigit((unsigned char)signame[6])) {
+#ifdef _SC_RTSIG_MAX
 		const long rtmax = sysconf(_SC_RTSIG_MAX);
+#else
+		const long rtmax = SIGRTMAX - SIGRTMIN;
+#endif
 		const int off = signame[6] - '0';
 
 		if (rtmax > 0 && off < rtmax / 2) {