From 2451a553681fac5e7e42bd794adbf5587bce6749 Mon Sep 17 00:00:00 2001 From: Prawn Date: Mon, 22 Jun 2020 18:56:29 +0200 Subject: [PATCH] zfs -V: Print userland version even if kernel module not loaded Running zfs -V when the modules are not loaded would currently result in the following output: zfs_version_kernel() failed: No such file or directory Note the lack of userland version output. Reorder the code to ensure the userland version is printed even when the kmods are not loaded. Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Signed-off-by: InsanePrawn Closes #10483 --- lib/libzfs/libzfs_util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 04936250b..21bd8289c 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1967,15 +1967,16 @@ zfs_version_print(void) char zver_userland[128]; char zver_kernel[128]; + zfs_version_userland(zver_userland, sizeof (zver_userland)); + + (void) printf("%s\n", zver_userland); + if (zfs_version_kernel(zver_kernel, sizeof (zver_kernel)) == -1) { fprintf(stderr, "zfs_version_kernel() failed: %s\n", strerror(errno)); return (-1); } - zfs_version_userland(zver_userland, sizeof (zver_userland)); - - (void) printf("%s\n", zver_userland); (void) printf("zfs-kmod-%s\n", zver_kernel); return (0);