artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6092c60
)
repair strtonum idiom and improve error messaging
author
deraadt
<deraadt@openbsd.org>
Wed, 1 Sep 2021 20:01:14 +0000
(20:01 +0000)
committer
deraadt
<deraadt@openbsd.org>
Wed, 1 Sep 2021 20:01:14 +0000
(20:01 +0000)
ok job
usr.bin/timeout/timeout.c
patch
|
blob
|
history
diff --git
a/usr.bin/timeout/timeout.c
b/usr.bin/timeout/timeout.c
index
9cb0ea0
..
1502146
100644
(file)
--- a/
usr.bin/timeout/timeout.c
+++ b/
usr.bin/timeout/timeout.c
@@
-111,21
+111,14
@@
parse_signal(const char *str)
if (strcasecmp(str, sys_signame[i]) == 0)
return (i);
}
-
- goto err;
+ err(1, "invalid signal name");
}
- errno = 0;
- sig = strtonum(str, LONG_MIN, LONG_MAX, &errstr);
+ sig = strtonum(str, 1, NSIG, &errstr);
if (errstr != NULL)
- goto err;
- if (sig >= NSIG || sig < 0)
- goto err;
+ err(1, "signal %s %s", str, errstr);
return (int)sig;
-
-err:
- err(1, "invalid signal");
}
static void