]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: add read-only warning
authorKarel Zak <kzak@redhat.com>
Fri, 28 Apr 2017 09:03:24 +0000 (11:03 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 28 Apr 2017 09:03:24 +0000 (11:03 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context.c
libmount/src/context_mount.c
sys-utils/mount.c

index a370cea09918b276f6daa71ef863daa2ea16f92a..b945298e61020bff600846bb917e6cee6eb52545 100644 (file)
@@ -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;
 }
index f2b42eb0b4b6248dcf961093f613dca48dc75f1e..9caee70e5ace421c22e82389aa3d99fcd3cc3480 100644 (file)
@@ -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;
        }
 
index 9d5c6e1bd3e61885ac57d7c9d8a1e7606059ceac..4d7a5fc73f31787269b8837a2734f4c89ddcd368 100644 (file)
@@ -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;
 }