X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fzinject%2Fzinject.c;h=13d067dc5f8ed4d8d47af23596eb4f3e05cfb832;hb=937210a54b9c2d3dddc7221e31d5695e9720a055;hp=9ae3f9ddc3adc9f0a4501c69ef3fbee876bf6321;hpb=cc92e9d0c3e67a7e66c844466f85696a087bf60a;p=zfs.git diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c index 9ae3f9d..13d067d 100644 --- a/cmd/zinject/zinject.c +++ b/cmd/zinject/zinject.c @@ -574,6 +574,16 @@ main(int argc, char **argv) int ret; int flags = 0; + 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 (argc == 1) { /* * No arguments. Print the available handlers. If there are no @@ -764,16 +774,6 @@ 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 (record.zi_duration != 0) record.zi_cmd = ZINJECT_IGNORED_WRITES;