diff options
author | 2000-12-22 22:46:57 +0000 | |
---|---|---|
committer | 2000-12-22 22:46:57 +0000 | |
commit | 0092bcff335e458372f5dc4a6f839420d276820c (patch) | |
tree | ffff17282cbd8cb0193d67ed395df5c50cb7118f | |
parent | when printing vrrp and verbose set -- print src/dst ip addrs (diff) | |
download | wireguard-openbsd-0092bcff335e458372f5dc4a6f839420d276820c.tar.xz wireguard-openbsd-0092bcff335e458372f5dc4a6f839420d276820c.zip |
use strtoul() instead of atoi()
-rw-r--r-- | usr.bin/top/top.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index e1dc1ab5eea..ac6035207d2 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.5 2000/11/21 07:22:19 deraadt Exp $ */ +/* $OpenBSD: top.c,v 1.6 2000/12/22 22:46:57 deraadt Exp $ */ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; @@ -276,13 +276,18 @@ char *argv[]; break; case 's': - if ((delay = atoi(optarg)) < 0) { + char *endp; + + delay = strtoul(optarg, &endp, 10); + if (delay < 0 || *endp != '\0') + { fprintf(stderr, "%s: warning: seconds delay should be non-negative -- using default\n", myname); delay = Default_DELAY; warnings++; + } } break; |