aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2019-04-08 09:14:45 -0700
committerGitHub <[email protected]>2019-04-08 09:14:45 -0700
commitc375c69ecad41f68610ad1186355822e28744476 (patch)
tree98b7a521b14cb7f927404196eb7eb852cbdd9884 /cmd/zfs
parentac4985e48dfcf030418df0f0ce9bf153ba12ba03 (diff)
Fix 'zfs list -t snapshot' depth
Commit df583073 introduced the ability to list the snapshots for a specified dataset. This change inadvertently resulted in only the top- level snapshots being listed when no dataset was specified. Fix this issue by adding an additional check to determine if a dataset was provided to avoid incorrectly restricting the depth. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Alek Pinchuk <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #8591 Closes #8594
Diffstat (limited to 'cmd/zfs')
-rw-r--r--cmd/zfs/zfs_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 57eb30528..5df206293 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -1926,7 +1926,7 @@ zfs_do_get(int argc, char **argv)
* Handle users who want to get all snapshots of the current
* dataset (ex. 'zfs get -t snapshot refer <dataset>').
*/
- if (types == ZFS_TYPE_SNAPSHOT &&
+ if (types == ZFS_TYPE_SNAPSHOT && argc > 1 &&
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
limit = 1;
@@ -3430,7 +3430,7 @@ zfs_do_list(int argc, char **argv)
* Handle users who want to list all snapshots of the current
* dataset (ex. 'zfs list -t snapshot <dataset>').
*/
- if (types == ZFS_TYPE_SNAPSHOT &&
+ if (types == ZFS_TYPE_SNAPSHOT && argc > 0 &&
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
limit = 1;