]> granicus.if.org Git - zfs/commitdiff
Fix parsable 'zfs get' for compressratios
authorLOLi <loli10K@users.noreply.github.com>
Thu, 3 Aug 2017 16:43:17 +0000 (18:43 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 3 Aug 2017 16:43:17 +0000 (09:43 -0700)
This is consistent with the change introduced in bc2d809 where
'zpool get -p dedupratio' does not add a trailing "x" to the output.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6436
Closes #6449

lib/libzfs/libzfs_dataset.c

index b37c89e41620e8176b6b661ced336fa12798a891..1270072b2fc4931ec1fbbbdd4deae7f74431dc23 100644 (file)
@@ -2601,9 +2601,14 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
        case ZFS_PROP_COMPRESSRATIO:
                if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
                        return (-1);
-               (void) snprintf(propbuf, proplen, "%llu.%02llux",
-                   (u_longlong_t)(val / 100),
-                   (u_longlong_t)(val % 100));
+               if (literal)
+                       (void) snprintf(propbuf, proplen, "%llu.%02llu",
+                           (u_longlong_t)(val / 100),
+                           (u_longlong_t)(val % 100));
+               else
+                       (void) snprintf(propbuf, proplen, "%llu.%02llux",
+                           (u_longlong_t)(val / 100),
+                           (u_longlong_t)(val % 100));
                break;
 
        case ZFS_PROP_TYPE: