From: Karel Zak Date: Thu, 12 Aug 2021 11:41:56 +0000 (+0200) Subject: libmount: show options string on parse error X-Git-Tag: v2.38-rc1~302 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52f05cd4c392083aa4a53b24f0ab971d4d38cf80;p=thirdparty%2Futil-linux.git libmount: show options string on parse error Signed-off-by: Karel Zak --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index a0f1efa319..84bc770b36 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -1767,10 +1767,20 @@ int mnt_context_get_mount_excode( } return MNT_EX_USAGE; case -MNT_ERR_MOUNTOPT: - if (buf) - snprintf(buf, bufsz, errno ? + if (buf) { + const char *opts = mnt_context_get_options(cxt); + + if (!opts) + opts = ""; + if (opts) + snprintf(buf, bufsz, errno ? + _("failed to parse mount options '%s': %m") : + _("failed to parse mount options '%s'"), opts); + else + snprintf(buf, bufsz, errno ? _("failed to parse mount options: %m") : _("failed to parse mount options")); + } return MNT_EX_USAGE; case -MNT_ERR_LOOPDEV: if (buf)