diff options
author | Karel Zak | 2017-04-28 11:03:24 +0200 |
---|---|---|
committer | Karel Zak | 2017-04-28 11:03:24 +0200 |
commit | 0361cb6f9bb8f74438c0577d968eb6f4bf9a2515 (patch) | |
tree | c1a3ca87fbc4a940d6227141a91277dc1c3c2607 | |
parent | include/exitcodes: remove mount(8) exit codes (diff) | |
download | kernel-qcow2-util-linux-0361cb6f9bb8f74438c0577d968eb6f4bf9a2515.tar.gz kernel-qcow2-util-linux-0361cb6f9bb8f74438c0577d968eb6f4bf9a2515.tar.xz kernel-qcow2-util-linux-0361cb6f9bb8f74438c0577d968eb6f4bf9a2515.zip |
libmount: add read-only warning
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/context.c | 2 | ||||
-rw-r--r-- | libmount/src/context_mount.c | 2 | ||||
-rw-r--r-- | sys-utils/mount.c | 8 |
3 files changed, 5 insertions, 7 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index a370cea09..b945298e6 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -2362,7 +2362,7 @@ int mnt_context_get_excode( break; } - DBG(CXT, ul_debugobj(cxt, "return code: %d [%s]", rc, + DBG(CXT, ul_debugobj(cxt, "excode: rc=%d message=\"%s\"", rc, buf ? buf : "<no-message>")); return rc; } diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index f2b42eb0b..9caee70e5 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -1311,6 +1311,8 @@ int mnt_context_get_mount_excode( /* * Libmount success && syscall success. */ + if (buf && mnt_context_forced_rdonly(cxt)) + snprintf(buf, bufsz, _("WARNING: device write-protected, mounted read-only")); return MNT_EX_SUCCESS; } diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 9d5c6e1bd..4d7a5fc73 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -305,12 +305,8 @@ static int mk_exit_code(struct libmnt_context *cxt, int rc) warnx(_("%s: %s."), spec, buf); } - if (rc == MNT_EX_SUCCESS) { - if (mnt_context_get_status(cxt) == 1) - selinux_warning(cxt, tgt); - - if (mnt_context_forced_rdonly(cxt)) - warnx(_("%s: WARNING: device write-protected, mounted read-only."), tgt); + if (rc == MNT_EX_SUCCESS && mnt_context_get_status(cxt) == 1) { + selinux_warning(cxt, tgt); } return rc; } |