summaryrefslogtreecommitdiffstats
path: root/cmd/zfs
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2019-05-08 19:42:39 -0400
committerBrian Behlendorf <[email protected]>2019-05-08 16:42:39 -0700
commit4bb40c1c82f0c11d231cbb4e2bd3bee1b550ad0b (patch)
tree086c2400329d6d6f3e4e912cfaa8047813614a0b /cmd/zfs
parent97aa3ba44f0b3911866e5dfc31b0d7a9fb124855 (diff)
Fix dataset name comparison in zfs_compare()
The code never returned match comparing two datasets (not snapshots). As result, uu_avl_find(), called from zfs_callback(), never succeeded, allowing to add same dataset into the list multiple times, for example: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers name pers - pers@z name pers@z - With the patch: # zfs get name pers pers pers@z pers@z NAME PROPERTY VALUE SOURCE pers name pers - pers@z name pers@z - Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Closes #8723
Diffstat (limited to 'cmd/zfs')
-rw-r--r--cmd/zfs/zfs_iter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c
index d10bbed7d..f2359508c 100644
--- a/cmd/zfs/zfs_iter.c
+++ b/cmd/zfs/zfs_iter.c
@@ -240,7 +240,7 @@ zfs_compare(const void *larg, const void *rarg, void *unused)
*rat = '\0';
ret = strcmp(lname, rname);
- if (ret == 0) {
+ if (ret == 0 && (lat != NULL || rat != NULL)) {
/*
* If we're comparing a dataset to one of its snapshots, we
* always make the full dataset first.