From 52f05cd4c392083aa4a53b24f0ab971d4d38cf80 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 12 Aug 2021 13:41:56 +0200 Subject: [PATCH] libmount: show options string on parse error Signed-off-by: Karel Zak --- libmount/src/context_mount.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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) -- 2.47.2