zfs: wait: only accept whole activity for -t, not act[=whatever]
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12996
This commit is contained in:
parent
66cd170db3
commit
15aca3ad59
|
@ -8503,27 +8503,25 @@ zfs_do_wait(int argc, char **argv)
|
|||
while ((c = getopt(argc, argv, "t:")) != -1) {
|
||||
switch (c) {
|
||||
case 't':
|
||||
{
|
||||
static char *col_subopts[] = { "deleteq", NULL };
|
||||
char *value;
|
||||
|
||||
/* Reset activities array */
|
||||
memset(&enabled, 0, sizeof (enabled));
|
||||
while (*optarg != '\0') {
|
||||
int activity = getsubopt(&optarg, col_subopts,
|
||||
&value);
|
||||
|
||||
if (activity < 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"),
|
||||
value);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||
static const char *const col_subopts[
|
||||
ZFS_WAIT_NUM_ACTIVITIES] = { "deleteq" };
|
||||
|
||||
enabled[activity] = B_TRUE;
|
||||
for (i = 0; i < ARRAY_SIZE(col_subopts); ++i)
|
||||
if (strcmp(tok, col_subopts[i]) == 0) {
|
||||
enabled[i] = B_TRUE;
|
||||
goto found;
|
||||
}
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid activity '%s'\n"), tok);
|
||||
usage(B_FALSE);
|
||||
found:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
|
|
Loading…
Reference in New Issue