diff options
author | ru <ru@FreeBSD.org> | 2007-11-09 15:14:08 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2007-11-09 15:14:08 +0000 |
commit | 1a8465da888065533bb9fd37939cf4dd8f3589e7 (patch) | |
tree | 82c9cbf737f6309bc1bcbbbcedd90532dfa58025 /usr.bin/killall | |
parent | 1f9b2f54c80babda97c71ee3951c775523b48121 (diff) | |
download | FreeBSD-src-1a8465da888065533bb9fd37939cf4dd8f3589e7.zip FreeBSD-src-1a8465da888065533bb9fd37939cf4dd8f3589e7.tar.gz |
Fix numerous bugs when parsing options and arguments.
Diffstat (limited to 'usr.bin/killall')
-rw-r--r-- | usr.bin/killall/killall.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index 10537e6..b991b15 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -154,11 +154,12 @@ main(int ac, char **av) switch (**av) { case 'j': ++*av; - if (**av == '\0') + if (**av == '\0') { ++av; - --ac; + --ac; + } jflag++; - if (!*av) + if (*av == NULL) errx(1, "must specify jid"); jid = strtol(*av, &ep, 10); if (!*av || *ep) @@ -168,23 +169,32 @@ main(int ac, char **av) break; case 'u': ++*av; - if (**av == '\0') + if (**av == '\0') { ++av; - --ac; + --ac; + } + if (*av == NULL) + errx(1, "must specify user"); user = *av; break; case 't': ++*av; - if (**av == '\0') + if (**av == '\0') { ++av; - --ac; + --ac; + } + if (*av == NULL) + errx(1, "must specify tty"); tty = *av; break; case 'c': ++*av; - if (**av == '\0') + if (**av == '\0') { ++av; - --ac; + --ac; + } + if (*av == NULL) + errx(1, "must specify procname"); cmd = *av; break; case 'v': |