mount: (new) improve mount -a exist codes and erroer messages
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
4e45dfb9a6
commit
d946359a5b
|
@ -60,6 +60,8 @@
|
||||||
static int passfd = -1;
|
static int passfd = -1;
|
||||||
static int readwrite;
|
static int readwrite;
|
||||||
|
|
||||||
|
static int mk_exit_code(struct libmnt_context *cxt, int rc);
|
||||||
|
|
||||||
static void __attribute__((__noreturn__)) exit_non_root(const char *option)
|
static void __attribute__((__noreturn__)) exit_non_root(const char *option)
|
||||||
{
|
{
|
||||||
const uid_t ruid = getuid();
|
const uid_t ruid = getuid();
|
||||||
|
@ -196,24 +198,16 @@ static int mount_all(struct libmnt_context *cxt)
|
||||||
tgt);
|
tgt);
|
||||||
|
|
||||||
} else if (mnt_context_is_fork(cxt)) {
|
} else if (mnt_context_is_fork(cxt)) {
|
||||||
printf("%-25s: mount successfully forked\n", tgt);
|
if (mnt_context_is_verbose(cxt))
|
||||||
|
printf("%-25s: mount successfully forked\n", tgt);
|
||||||
} else {
|
} else {
|
||||||
if (!mnt_context_get_status(cxt)) {
|
rc |= mk_exit_code(cxt, mntrc);
|
||||||
if (mntrc > 0) {
|
|
||||||
errno = mntrc;
|
if (mnt_context_get_status(cxt)) {
|
||||||
printf(_("%-25s: failed: %s\n"), tgt,
|
rc |= EX_SOMEOK;
|
||||||
strerror(mntrc));
|
|
||||||
rc |= EX_FAIL;
|
|
||||||
} else {
|
|
||||||
printf(_("%-25s: failed\n"), tgt);
|
|
||||||
rc |= EX_SYSERR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (mnt_context_is_verbose(cxt))
|
if (mnt_context_is_verbose(cxt))
|
||||||
printf("%-25s: successfully mounted\n", tgt);
|
printf("%-25s: successfully mounted\n", tgt);
|
||||||
|
|
||||||
rc |= EX_SOMEOK;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue