aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/top
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2018-08-22 09:49:38 +0000
committerEitan Adler <eadler@FreeBSD.org>2018-08-22 09:49:38 +0000
commiteeb147d528d7a032fc411bd4afecc3065b5f9282 (patch)
treec0e31c1ae7c6a6b5144339926600cd49c14d7446 /usr.bin/top
parentcd615bf560eca2cfb4cab900a94f4077c6644d55 (diff)
downloadsrc-eeb147d528d7a032fc411bd4afecc3065b5f9282.tar.gz
src-eeb147d528d7a032fc411bd4afecc3065b5f9282.zip
Notes
Diffstat (limited to 'usr.bin/top')
-rw-r--r--usr.bin/top/top.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 558491da3c3b..b76dbb54676d 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -21,6 +21,7 @@
#include <sys/signal.h>
#include <assert.h>
+#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <jail.h>
@@ -253,6 +254,7 @@ main(int argc, char *argv[])
char *order_name = NULL;
int order_index = 0;
fd_set readfds;
+ char *nptr;
/* set the buffer for stdout */
#ifdef DEBUG
@@ -386,7 +388,12 @@ main(int argc, char *argv[])
}
case 's':
- delay = strtod(optarg, NULL);
+ delay = strtod(optarg, &nptr);
+ if (nptr == optarg) {
+ warnx("warning: invalid delay");
+ delay = 2;
+ warnings++;
+ }
if (delay < 0) {
fprintf(stderr,
"%s: warning: seconds delay should be positive -- using default\n",