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 <andyf@speednet.com.au>
MFC after:	1 week
This commit is contained in:
gonzo 2019-01-23 02:46:35 +00:00
parent 793efae8e7
commit 17dd66970a

View File

@ -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);