X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fzinject%2Fzinject.c;h=3ad90e3299e3e9dc62134c5e6ddf71f4f0b08b50;hb=ac063c48ae12061bbe0f66b3a9d641239782ae62;hp=643d73e7fd8c44ea654d7127f4bed4b76f8359e1;hpb=d603ed6c278f9c25b17ba8e75e9bce6e5d715ac0;p=zfs.git diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c index 643d73e..3ad90e3 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.