]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: try to tell what mount was doing when it failed
authorSami Kerola <kerolasa@iki.fi>
Sat, 16 Apr 2016 18:05:58 +0000 (19:05 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jun 2016 09:17:58 +0000 (11:17 +0200)
Earlier output did not give enough information to system admin to fix an
issue in /etc/fstab effectively.

$ sudo mount -a
mount: mount(2) failed: No such file or directory

Addresses: https://bugs.launchpad.net/bugs/1557145
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/mount.c

index 9c4729ef890d7f30a666d2b49c5f359a5affcfa4..64ec0a779423de0485dc77fbe620de02468d5421 100644 (file)
@@ -520,7 +520,12 @@ try_readonly:
                        warnx(_("special device %s does not exist"), src);
                } else {
                        errno = syserr;
-                       warn(_("mount(2) failed"));     /* print errno */
+                       if (tgt)
+                               warn("%s: %s", _("mount(2) failed"), tgt);
+                       else if (src)
+                               warn("%s: %s", _("mount(2) failed"), src);
+                       else
+                               warn(_("mount(2) failed"));
                }
                break;
 
@@ -535,7 +540,7 @@ try_readonly:
                                 "(a path prefix is not a directory)"), src);
                } else {
                        errno = syserr;
-                       warn(_("mount(2) failed"));     /* print errno */
+                       warn("%s: %s", _("mount(2) failed"), tgt);
                }
                break;