From c1e3adfb8ee9483704e2f6c41734ef663ec779ee Mon Sep 17 00:00:00 2001 From: cheloha Date: Sat, 10 Feb 2018 19:49:50 +0000 Subject: [PATCH] Cap wait/interval at 100 million seconds. Keeps nanosleep(2) from choking. While here, call the argument to the -w flag "wait" in the error message to match up with documentation and usage(). ok tedu@ deraadt@ tb@ --- usr.sbin/iostat/iostat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index c85c6fc2cbb..27f710a47a2 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iostat.c,v 1.39 2015/10/23 08:21:27 tedu Exp $ */ +/* $OpenBSD: iostat.c,v 1.40 2018/02/10 19:49:50 cheloha Exp $ */ /* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */ /* @@ -146,9 +146,9 @@ main(int argc, char *argv[]) todo |= SHOW_TTY; break; case 'w': - interval = strtonum(optarg, 1, INT_MAX, &errstr); + interval = strtonum(optarg, 1, 100000000, &errstr); if (errstr) - errx(1, "interval is %s", errstr); + errx(1, "wait is %s", errstr); break; case '?': default: @@ -419,7 +419,7 @@ selectdrives(char *argv[]) errx(1, "invalid interval or drive name: %s", *argv); } if (*argv) { - interval = strtonum(*argv, 1, INT_MAX, &errstr); + interval = strtonum(*argv, 1, 100000000, &errstr); if (errstr) errx(1, "interval is %s", errstr); if (*++argv) { -- 2.20.1