summaryrefslogtreecommitdiffstats
path: root/cmd/zinject
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/zinject
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/zinject')
-rw-r--r--cmd/zinject/zinject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c
index f6c89159e..f64e50462 100644
--- a/cmd/zinject/zinject.c
+++ b/cmd/zinject/zinject.c
@@ -572,8 +572,10 @@ main(int argc, char **argv)
int ret;
int flags = 0;
- 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);