diff options
author | LOLi <[email protected]> | 2017-08-03 18:43:17 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-08-03 09:43:17 -0700 |
commit | b0bd8ffecd70b46e584e2e52ea74f2373b544217 (patch) | |
tree | 8c259046f9341cd83c63a8e84e4c2c2aeb3f7c19 /lib/libzfs/libzfs_dataset.c | |
parent | e3bdcb8ad88e7a90726193c9afe96a713729c928 (diff) |
Fix parsable 'zfs get' for compressratios
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 <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #6436
Closes #6449
Diffstat (limited to 'lib/libzfs/libzfs_dataset.c')
-rw-r--r-- | lib/libzfs/libzfs_dataset.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index b37c89e41..1270072b2 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -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: |