summaryrefslogtreecommitdiffstats
path: root/usr.bin/killall
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-03-30 16:24:03 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-03-30 16:24:03 +0000
commit59fa66220ea04959e377ec1831047b655bbe4da6 (patch)
treeb4af2c83128c6311bfc2c155dd27b8c013653a8b /usr.bin/killall
parent2f7ae9b73937f5da2e6cdcd3158a0213362e9c74 (diff)
downloadFreeBSD-src-59fa66220ea04959e377ec1831047b655bbe4da6.zip
FreeBSD-src-59fa66220ea04959e377ec1831047b655bbe4da6.tar.gz
Use the method described in the strtol man page to check if it parsed
the entire string. This avoids signed/unsigned comparison.
Diffstat (limited to 'usr.bin/killall')
-rw-r--r--usr.bin/killall/killall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index 463ea5c..7be6bc6 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -225,7 +225,7 @@ main(int ac, char **av)
}
if (user) {
uid = strtol(user, &ep, 10);
- if ((ep - user) < strlen(user)) {
+ if (*user == '\0' || *ep != '\0') { /* was it a number? */
pw = getpwnam(user);
if (pw == NULL)
errx(1, "user %s does not exist", user);
OpenPOWER on IntegriCloud