]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zpool: get: there's one fewer column than in zfs get
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Sat, 22 Jan 2022 22:17:49 +0000 (23:17 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 15 Mar 2022 22:14:18 +0000 (15:14 -0700)
The current code allows -o name,property,value,source,name

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12996

cmd/zpool/zpool_main.c

index 7142c219cb7e1f219b86ea5c32602df82d956ad3..b680b6c84cde230f5e8d03812299a7f844a300f0 100644 (file)
@@ -10106,7 +10106,7 @@ zpool_do_get(int argc, char **argv)
                                { GET_COL_NAME, GET_COL_PROPERTY, GET_COL_VALUE,
                                    GET_COL_SOURCE };
 
-                               if (i == ZFS_GET_NCOLS) {
+                               if (i == ZFS_GET_NCOLS - 1) {
                                        (void) fprintf(stderr, gettext("too "
                                        "many fields given to -o "
                                        "option\n"));
@@ -10133,7 +10133,7 @@ found:
 
                                        memcpy(cb.cb_columns, col_cols,
                                            sizeof (col_cols));
-                                       i = ZFS_GET_NCOLS;
+                                       i = ZFS_GET_NCOLS - 1;
                                } else
                                        cb.cb_columns[i++] = col_cols[c];
                        }