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>
This commit is contained in:
Karel Zak 2014-04-07 11:53:05 +02:00
parent e0d4675789
commit 8ab82185ee
1 changed files with 6 additions and 4 deletions

View File

@ -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++;