diff options
author | Brian Behlendorf <[email protected]> | 2010-08-26 11:57:29 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-08-31 13:42:01 -0700 |
commit | 9b020fd97a3dc449a94baec028b30b1fe3c2d5bc (patch) | |
tree | 63adfe1e69722f283a5115ff431abb550f691bed /cmd/zinject/zinject.c | |
parent | d603ed6c278f9c25b17ba8e75e9bce6e5d715ac0 (diff) |
Add linux user util support
This topic branch contains required changes to the user space
utilities to allow them to integrate cleanly with Linux.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'cmd/zinject/zinject.c')
-rw-r--r-- | cmd/zinject/zinject.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c index 643d73e7f..3ad90e329 100644 --- a/cmd/zinject/zinject.c +++ b/cmd/zinject/zinject.c @@ -573,19 +573,6 @@ main(int argc, char **argv) int ret; int flags = 0; - if ((g_zfs = libzfs_init()) == NULL) { - (void) fprintf(stderr, "internal error: failed to " - "initialize ZFS library\n"); - return (1); - } - - libzfs_print_on_error(g_zfs, B_TRUE); - - if ((zfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { - (void) fprintf(stderr, "failed to open ZFS device\n"); - return (1); - } - if (argc == 1) { /* * No arguments. Print the available handlers. If there are no @@ -765,6 +752,16 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if ((g_zfs = libzfs_init()) == NULL) + return (1); + + libzfs_print_on_error(g_zfs, B_TRUE); + + if ((zfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { + (void) fprintf(stderr, "failed to open ZFS device\n"); + return (1); + } + if (cancel != NULL) { /* * '-c' is invalid with any other options. |