aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd
diff options
context:
space:
mode:
authorAllan Jude <allanjude@FreeBSD.org>2019-05-18 12:27:22 +0000
committerAllan Jude <allanjude@FreeBSD.org>2019-05-18 12:27:22 +0000
commit19a9d4fa28fbcc2c994295733165962b5d829361 (patch)
tree45d99818af5de36fa4f9544b8bd62a2e2a799b7f /cddl/contrib/opensolaris/cmd
parenta57ec59f9caf1320cf24cd3ba703c34348af6568 (diff)
downloadsrc-19a9d4fa28fbcc2c994295733165962b5d829361.tar.gz
src-19a9d4fa28fbcc2c994295733165962b5d829361.zip
MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee zfs_main: fix `zfs userspace` squashing unresolved entries The `zfs userspace` squashes all entries with unresolved numeric values into a single output entry due to the comparsion always made by the string name which is empty in case of unresolved IDs. Fix this by falling to a numerical comparison when either one of string values is not found. This then compares any numerical values after all with a name resolved. Signed-off-by: Pavel Boldin <boldin.pavel@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Reported by: clusteradm Obtained from: ZFS-on-Linux MFC after: 3 days
Notes
Notes: svn path=/head/; revision=347953
Diffstat (limited to 'cddl/contrib/opensolaris/cmd')
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index 7f7cc2dfac68..61c97834a312 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -2361,6 +2361,7 @@ us_compare(const void *larg, const void *rarg, void *unused)
case ZFS_PROP_NAME:
propname = "name";
if (numname) {
+compare_nums:
(void) nvlist_lookup_uint64(lnvl, propname,
&lv64);
(void) nvlist_lookup_uint64(rnvl, propname,
@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *unused)
if (rv64 != lv64)
rc = (rv64 < lv64) ? 1 : -1;
} else {
- (void) nvlist_lookup_string(lnvl, propname,
- &lvstr);
- (void) nvlist_lookup_string(rnvl, propname,
- &rvstr);
+ if ((nvlist_lookup_string(lnvl, propname,
+ &lvstr) == ENOENT) ||
+ (nvlist_lookup_string(rnvl, propname,
+ &rvstr) == ENOENT)) {
+ goto compare_nums;
+ }
rc = strcmp(lvstr, rvstr);
}
break;