From: kn Date: Sat, 2 Jul 2022 19:00:35 +0000 (+0000) Subject: Make -s accept HUP like kill(1) and GNU timeout(1) do X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2a4adf00f260d32c40a6b3fc84380b6de6ef7a1e;p=openbsd 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 --- 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 @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -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);