aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zpool
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2015-05-20 14:39:52 -0700
committerBrian Behlendorf <[email protected]>2015-05-22 13:34:58 -0700
commit65037d9b25c2bfa98d0aa5c9e34678127c03b345 (patch)
treef952dd40e26497af55a6a61cf9c42ea6baa7d6dc /cmd/zpool
parent87abfcba2283bfeb6636caf9aa2a72186d7708c4 (diff)
Add libzfs_error_init() function
All fprintf() error messages are moved out of the libzfs_init() library function where they never belonged in the first place. A libzfs_error_init() function is added to provide useful error messages for the most common causes of failure. Additionally, in libzfs_run_process() the 'rc' variable was renamed to 'error' for consistency with the rest of the code base. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Richard Yao <[email protected]>
Diffstat (limited to 'cmd/zpool')
-rw-r--r--cmd/zpool/zpool_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index bf323ee08..5c28e8bb1 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -5919,8 +5919,10 @@ main(int argc, char **argv)
if ((strcmp(cmdname, "-?") == 0) || strcmp(cmdname, "--help") == 0)
usage(B_TRUE);
- if ((g_zfs = libzfs_init()) == NULL)
+ if ((g_zfs = libzfs_init()) == NULL) {
+ (void) fprintf(stderr, "%s", libzfs_error_init(errno));
return (1);
+ }
libzfs_print_on_error(g_zfs, B_TRUE);