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) {
|
while ((c = getopt(argc, argv, "t:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 't':
|
case 't':
|
||||||
{
|
|
||||||
static char *col_subopts[] = { "deleteq", NULL };
|
|
||||||
char *value;
|
|
||||||
|
|
||||||
/* Reset activities array */
|
/* Reset activities array */
|
||||||
memset(&enabled, 0, sizeof (enabled));
|
memset(&enabled, 0, sizeof (enabled));
|
||||||
while (*optarg != '\0') {
|
|
||||||
int activity = getsubopt(&optarg, col_subopts,
|
|
||||||
&value);
|
|
||||||
|
|
||||||
if (activity < 0) {
|
for (char *tok; (tok = strsep(&optarg, ",")); ) {
|
||||||
(void) fprintf(stderr,
|
static const char *const col_subopts[
|
||||||
gettext("invalid activity '%s'\n"),
|
ZFS_WAIT_NUM_ACTIVITIES] = { "deleteq" };
|
||||||
value);
|
|
||||||
usage(B_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
break;
|
||||||
}
|
|
||||||
case '?':
|
case '?':
|
||||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||||
optopt);
|
optopt);
|
||||||
|
|
Loading…
Reference in New Issue