From d65e72a8188d69cd41f595ea570a8b1536ed3203 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Wed, 23 Jan 2019 02:46:35 +0000 Subject: [PATCH] Fix systat's :only command parser for the multiple arguments case According to systat(1) :only option is supposed to accept multiple drives but the parser for its arguments stops after first entry. Fix the parser logic to accept multiple drives. PR: 59220 Reported by: Andy Farkas MFC after: 1 week --- usr.bin/systat/devs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index c802a843eb2c..62c511d62ae6 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -288,7 +288,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs, ; if (*cp) *cp++ = '\0'; - if (cp - args == 0) + if (cp - tmpstr1 == 0) break; for (i = 0; i < num_devices; i++) { asprintf(&buffer, "%s%d", dev_select[i].device_name, @@ -312,7 +312,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs, } if (i >= num_devices) error("%s: unknown drive", args); - args = cp; + tmpstr1 = cp; } free(tmpstr);