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:
Oleksandr Tymoshenko 2019-01-23 02:46:35 +00:00
parent 16ac070581
commit d65e72a818
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343338

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