summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-07-02 19:00:36 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-07-02 19:00:36 +0000
commit7f47b4e5a0952e58e4a606dd12c2524a5e069c5f (patch)
treec2085fcf20f9cbb6829a230cdc0797b729c21afc /usr.bin
parent54ab6d5f18c5579383aaef70b0ed0697d9cf0c4d (diff)
Make -s accept HUP like kill(1) and GNU timeout(1) do
timeout.c's parse_signal() basically does what kill.c's signame_to_num() does, except it expects "SIG" in string signals. Borrow the isalpha() check from kill.c to get the same behaviour. OK deraadt
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/timeout/timeout.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
index 057b396950d..f93d782f901 100644
--- a/usr.bin/timeout/timeout.c
+++ b/usr.bin/timeout/timeout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timeout.c,v 1.20 2022/01/12 22:51:44 tb Exp $ */
+/* $OpenBSD: timeout.c,v 1.21 2022/07/02 19:00:35 kn Exp $ */
/*
* Copyright (c) 2021 Job Snijders <job@openbsd.org>
@@ -32,6 +32,7 @@
#include <sys/time.h>
#include <sys/wait.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <getopt.h>
@@ -104,10 +105,11 @@ parse_signal(const char *str)
long long sig;
const char *errstr;
- if (strncasecmp(str, "SIG", 3) == 0) {
+ if (isalpha((unsigned char)*str)) {
int i;
- str += 3;
+ if (strncasecmp(str, "SIG", 3) == 0)
+ str += 3;
for (i = 1; i < NSIG; i++) {
if (strcasecmp(str, sys_signame[i]) == 0)
return (i);