summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-04-07 11:53:05 +0200
committerKarel Zak <kzak@redhat.com>2014-04-23 11:55:08 +0200
commit5f148289adf1f390c3e5f8fce73dd2a13eb3b6f8 (patch)
tree553808995a5b913d29417b074f6596092426893c
parent9ae50bae04183ede08e69117b5800b780c031a4c (diff)
downloadutil-linux-5f148289adf1f390c3e5f8fce73dd2a13eb3b6f8.tar.gz
mount: fix --all and nofail return code
Now the "nofail" affects warnings warning messages only. That's wrong and regression (against original non-libmount version). The nofail has to control return code too. Reported-by: Patrick McLean <chutzpah@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--sys-utils/mount.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index ed814ca49..29fb2f2c9 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -197,12 +197,14 @@ static int mount_all(struct libmnt_context *cxt)
if (mnt_context_is_verbose(cxt))
printf("%-25s: mount successfully forked\n", tgt);
} else {
- mk_exit_code(cxt, mntrc); /* to print warnings */
-
- if (mnt_context_get_status(cxt)) {
+ if (mk_exit_code(cxt, mntrc) == MOUNT_EX_SUCCESS) {
nsucc++;
- if (mnt_context_is_verbose(cxt))
+ /* Note that MOUNT_EX_SUCCESS return code does
+ * not mean that FS has been really mounted
+ * (e.g. nofail option) */
+ if (mnt_context_get_status(cxt)
+ && mnt_context_is_verbose(cxt))
printf("%-25s: successfully mounted\n", tgt);
} else
nerrs++;