summaryrefslogtreecommitdiffstats
path: root/sys-utils/mount.c
diff options
context:
space:
mode:
authorKarel Zak2012-04-17 11:36:36 +0200
committerKarel Zak2012-04-17 11:39:49 +0200
commit58f108ef2b9c8cc0362e7781a72e5e921dc383b3 (patch)
tree1d42790b7b86445328d7624403268c595ca0c3f2 /sys-utils/mount.c
parentlibmount: add mnt_context_fstab_applied() (diff)
downloadkernel-qcow2-util-linux-58f108ef2b9c8cc0362e7781a72e5e921dc383b3.tar.gz
kernel-qcow2-util-linux-58f108ef2b9c8cc0362e7781a72e5e921dc383b3.tar.xz
kernel-qcow2-util-linux-58f108ef2b9c8cc0362e7781a72e5e921dc383b3.zip
mount: (new) improve error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/mount.c')
-rw-r--r--sys-utils/mount.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index 0f6140690..d1e2e16c7 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -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"),