]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: (new) improve error messages
authorKarel Zak <kzak@redhat.com>
Tue, 17 Apr 2012 09:36:36 +0000 (11:36 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Apr 2012 09:39:49 +0000 (11:39 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/mount.c

index 0f61406906a6c3e2d97e4cbd416dd5bdd00bb055..d1e2e16c7a80badbb6ff4f96506e325ad03a18c1 100644 (file)
@@ -349,16 +349,13 @@ try_readonly:
                        return MOUNT_EX_USAGE;
                }
 
-               /*
-                * TODO: add mnt_context_fstab_applied() to check if we found
-                *       target/source in the file.
-                */
-               if (!tgt) {
-                       if (mflags & MS_REMOUNT)
-                               warnx(_("%s not mounted"), src ? src : tgt);
-                       else
+               if (!tgt || (!src && !(mflags & MS_PROPAGATION))) {
+                       if (!mnt_context_fstab_applied(cxt))
                                warnx(_("can't find %s in %s"), src ? src : tgt,
                                                mnt_get_fstab_path());
+                       else if (mflags & MS_REMOUNT)
+                               warnx(_("%s not mounted"), src ? src : tgt);
+
                        return MOUNT_EX_USAGE;
                }
 
@@ -467,6 +464,8 @@ try_readonly:
        case EINVAL:
                if (mflags & MS_REMOUNT)
                        warnx(_("%s not mounted or bad option"), tgt);
+               else if (mflags & MS_PROPAGATION)
+                       warnx(_("%s is not mountpoint or bad option"), tgt);
                else
                        warnx(_("wrong fs type, bad option, bad superblock on %s,\n"
                                "       missing codepage or helper program, or other error"),