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 <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: InsanePrawn <insane.prawny@gmail.com> Closes #10483
This commit is contained in:
parent
68301ba20e
commit
2451a55368
|
@ -1967,15 +1967,16 @@ zfs_version_print(void)
|
||||||
char zver_userland[128];
|
char zver_userland[128];
|
||||||
char zver_kernel[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) {
|
if (zfs_version_kernel(zver_kernel, sizeof (zver_kernel)) == -1) {
|
||||||
fprintf(stderr, "zfs_version_kernel() failed: %s\n",
|
fprintf(stderr, "zfs_version_kernel() failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
zfs_version_userland(zver_userland, sizeof (zver_userland));
|
|
||||||
|
|
||||||
(void) printf("%s\n", zver_userland);
|
|
||||||
(void) printf("zfs-kmod-%s\n", zver_kernel);
|
(void) printf("zfs-kmod-%s\n", zver_kernel);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
Loading…
Reference in New Issue