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 <igor@dilos.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Toomas Soome <tsoome@me.com> Closes #12650
This commit is contained in:
parent
a95c82bed8
commit
a4cecfbdc9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user