]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix zpool subcommands error message with some unsupported options
authorloli10K <loli10K@users.noreply.github.com>
Wed, 4 Sep 2019 20:36:25 +0000 (22:36 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 4 Sep 2019 20:36:25 +0000 (13:36 -0700)
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

cmd/zpool/zpool_main.c

index a3c76030d634f50416bd8c82e6b29969d706280e..b9c7462b618e19aa74fc0217d87149f96efbbdda 100644 (file)
@@ -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);
@@ -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);