From e8365fc1c68a28a8df0d5df3b03fa0eda05b05bc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 2 Oct 2017 13:44:29 +0200 Subject: [PATCH] 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 --- libmount/src/context_mount.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.47.2