diff options
author | Toomas Soome <[email protected]> | 2021-10-20 20:34:34 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-20 10:34:34 -0700 |
commit | a4cecfbdc96faa5c9887f9ceb7d233acde75223f (patch) | |
tree | 388503f8668126dbe4f4b2c5a3945429d849db02 | |
parent | a95c82bed84095d18375ef7aaacfb012ad52f13a (diff) |
zpool should call zfs_nicestrtonum() with non-NULL handle
When zfs_nicestrtonum() is called and there will be an error,
the message is left in libzfs handle, if provided. We can use
this message, to provide better feedback for user.
Reviewed-by: Igor Kozhukhov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Toomas Soome <[email protected]>
Closes #12650
-rw-r--r-- | cmd/zpool/zpool_main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index d42ff18d8..3a2caa9a8 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -7353,9 +7353,10 @@ zpool_do_trim(int argc, char **argv) "combined with the -c or -s options\n")); usage(B_FALSE); } - if (zfs_nicestrtonum(NULL, optarg, &rate) == -1) { - (void) fprintf(stderr, - gettext("invalid value for rate\n")); + if (zfs_nicestrtonum(g_zfs, optarg, &rate) == -1) { + (void) fprintf(stderr, "%s: %s\n", + gettext("invalid value for rate"), + libzfs_error_description(g_zfs)); usage(B_FALSE); } break; |