From: Sami Kerola Date: Sat, 16 Apr 2016 18:05:58 +0000 (+0100) Subject: mount: try to tell what mount was doing when it failed X-Git-Tag: v2.29-rc1~285^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=592fe0175f25a5d50d14de4eecdb7f22be4bdb39;p=thirdparty%2Futil-linux.git mount: try to tell what mount was doing when it failed 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 --- diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 9c4729ef89..64ec0a7794 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -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;