Skip to content

Commit 2451a55

Browse files
authored
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
1 parent 68301ba commit 2451a55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/libzfs/libzfs_util.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,15 +1967,16 @@ zfs_version_print(void)
19671967
char zver_userland[128];
19681968
char zver_kernel[128];
19691969

1970+
zfs_version_userland(zver_userland, sizeof (zver_userland));
1971+
1972+
(void) printf("%s\n", zver_userland);
1973+
19701974
if (zfs_version_kernel(zver_kernel, sizeof (zver_kernel)) == -1) {
19711975
fprintf(stderr, "zfs_version_kernel() failed: %s\n",
19721976
strerror(errno));
19731977
return (-1);
19741978
}
19751979

1976-
zfs_version_userland(zver_userland, sizeof (zver_userland));
1977-
1978-
(void) printf("%s\n", zver_userland);
19791980
(void) printf("zfs-kmod-%s\n", zver_kernel);
19801981

19811982
return (0);

0 commit comments

Comments
 (0)