diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c index e32748d2909b..90815813f8ce 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c @@ -225,7 +225,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.