aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_util.c
diff options
context:
space:
mode:
authorPrawn <[email protected]>2020-06-22 18:56:29 +0200
committerGitHub <[email protected]>2020-06-22 09:56:29 -0700
commit2451a553681fac5e7e42bd794adbf5587bce6749 (patch)
tree2e9aa546251003c935677a807f82ec5488f58eb4 /lib/libzfs/libzfs_util.c
parent68301ba20e0a6543304a63d22b558fddea130d79 (diff)
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #10483
Diffstat (limited to 'lib/libzfs/libzfs_util.c')
-rw-r--r--lib/libzfs/libzfs_util.c7
1 files 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);