]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: show options string on parse error
authorKarel Zak <kzak@redhat.com>
Thu, 12 Aug 2021 11:41:56 +0000 (13:41 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Aug 2021 11:41:56 +0000 (13:41 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_mount.c

index a0f1efa3193a0e590cb6ab4344f38b90a1801645..84bc770b3688330552d74460c001e2e6a81e206f 100644 (file)
@@ -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)