diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index fb337ca3f..fc7290314 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -2767,16 +2767,15 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, return (-1); /* - * If limit is UINT64_MAX, we translate this into 'none' (unless - * literal is set), and indicate that it's the default value. - * Otherwise, we print the number nicely and indicate that it's - * set locally. + * If limit is UINT64_MAX, we translate this into 'none', and + * indicate that it's the default value. Otherwise, we print + * the number nicely and indicate that it's set locally. */ - if (literal) { + if (val == UINT64_MAX) { + (void) strlcpy(propbuf, "none", proplen); + } else if (literal) { (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val); - } else if (val == UINT64_MAX) { - (void) strlcpy(propbuf, "none", proplen); } else { zfs_nicenum(val, propbuf, proplen); } diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh index 3547fb76c..deb501698 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh @@ -57,11 +57,14 @@ do ((i+=1)) done +typeset -r uint64_max="18446744073709551615" + typeset zfs_props=("type" used available creation volsize referenced \ compressratio mounted origin recordsize quota reservation mountpoint \ sharenfs checksum compression atime devices exec readonly setuid \ snapdir aclinherit canmount primarycache secondarycache version \ - usedbychildren usedbydataset usedbyrefreservation usedbysnapshots) + usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \ + filesystem_limit snapshot_limit filesystem_count snapshot_count) if is_freebsd; then typeset zfs_props_os=(jailed aclmode) else @@ -100,11 +103,21 @@ function check_return_value while read line; do typeset item - item=$(echo $line | awk '{print $2}' 2>&1) + typeset value + item=$(echo $line | awk '{print $2}' 2>&1) if [[ $item == $p ]]; then ((found += 1)) cols=$(echo $line | awk '{print NF}') + fi + + value=$(echo $line | awk '{print $3}' 2>&1) + if [[ $value == $uint64_max ]]; then + log_fail "'zfs get $opt $props $dst' return " \ + "UINT64_MAX constant." + fi + + if ((found > 0)); then break fi done < $TESTDIR/$TESTFILE0