From: Karel Zak Date: Mon, 2 Oct 2017 11:44:29 +0000 (+0200) Subject: libmount: add human compatible message for EBADMSG errno X-Git-Tag: v2.31-rc2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8365fc1c68a28a8df0d5df3b03fa0eda05b05bc;p=thirdparty%2Futil-linux.git libmount: add human compatible message for EBADMSG errno mount: /media/sdb5: mount(2) system call failed: Bad message. is really ugly for end users. It seems XFS, extN (etc) use EBADMSG for bad checksums. For network or pseudo filesystems continue to use "Bad message" error... Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1496764 Signed-off-by: Karel Zak --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index e84947f00a..8ef8063146 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -1578,6 +1578,14 @@ int mnt_context_get_mount_excode( snprintf(buf, bufsz, _("no medium found on %s"), src); break; + case EBADMSG: + /* Bad CRC for classic filesystems (e.g. extN or XFS) */ + if (buf && (S_ISBLK(st.st_mode) || S_ISREG(st.st_mode))) { + snprintf(buf, bufsz, _("cannot mount; probably corrupted filesystem on %s"), src); + break; + } + /* fallthrough */ + default: if (buf) { errno = syserr;