]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: add reason to "cannot detect on-disk filesystem type" warning
authorKarel Zak <kzak@redhat.com>
Fri, 21 Jan 2022 11:24:43 +0000 (12:24 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 21 Jan 2022 11:24:43 +0000 (12:24 +0100)
References: https://unix.stackexchange.com/questions/563688/findmnt-verify-gives-warning-cannot-detect-on-disk-filesystem-type
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt-verify.c

index 624c7205e832168272e4b95e707dfa31f239c655..609638c4d1a6648bc635409c77a07222ca710470 100644 (file)
@@ -443,13 +443,17 @@ static int verify_fstype(struct verify_context *vfy)
                if (!isswap && !isauto && !none && !is_supported_filesystem(vfy, type))
                        verify_warn(vfy, _("%s seems unsupported by the current kernel"), type);
        }
+
+       errno = 0;
        realtype = mnt_get_fstype(src, &ambi, cache);
 
        if (!realtype) {
+               const char *reson = errno ? strerror(errno) : _("reason uknown");
+
                if (isauto)
-                       verify_err(vfy, _("cannot detect on-disk filesystem type"));
+                       verify_err(vfy, _("cannot detect on-disk filesystem type (%s)"), reson);
                else
-                       verify_warn(vfy, _("cannot detect on-disk filesystem type"));
+                       verify_warn(vfy, _("cannot detect on-disk filesystem type (%s)"), reson);
                goto done;
        }