Skip to content

Commit

Permalink
Fix zpool subcommands error message with some unsupported options
Browse files Browse the repository at this point in the history
Both 'detach' and 'online' zpool subcommands, when provided with an
unsupported option, forget to print it in the error message:

   # zpool online -t rpool vda3
   invalid option ''
   usage:
      online [-e] <pool> <device> ...

This changes fixes the error message in order to include the actual
option that is not supported.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #9270
  • Loading branch information
loli10K authored and tonyhutter committed Sep 25, 2019
1 parent 9f261b1 commit 146d7d8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6111,9 +6111,8 @@ zpool_do_detach(int argc, char **argv)
int ret;

/* check options */
while ((c = getopt(argc, argv, "f")) != -1) {
while ((c = getopt(argc, argv, "")) != -1) {
switch (c) {
case 'f':
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
Expand Down Expand Up @@ -6342,12 +6341,11 @@ zpool_do_online(int argc, char **argv)
int flags = 0;

/* check options */
while ((c = getopt(argc, argv, "et")) != -1) {
while ((c = getopt(argc, argv, "e")) != -1) {
switch (c) {
case 'e':
flags |= ZFS_ONLINE_EXPAND;
break;
case 't':
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
Expand Down

0 comments on commit 146d7d8

Please sign in to comment.