mount: fewer warnings in a mount pt is non-mandatory #2
authorRobert Swiecki <robert@swiecki.net>
Sun, 28 May 2017 12:53:16 +0000 (14:53 +0200)
committerRobert Swiecki <robert@swiecki.net>
Sun, 28 May 2017 12:53:16 +0000 (14:53 +0200)
mount.c

diff --git a/mount.c b/mount.c
index 8d9446e8f1174cf0beed52457bb3359afad08365..cfd2ed275cdceebf60a5a61777afbac9c658dbf7 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -191,8 +191,13 @@ static bool mountRemountRO(struct mounts_t *mpt)
 
        struct statvfs vfs;
        if (TEMP_FAILURE_RETRY(statvfs(mpt->dst, &vfs)) == -1) {
-               PLOG_E("statvfs('%s')", mpt->dst);
-               return false;
+               if (mpt->mandatory) {
+                       PLOG_E("statvfs('%s')", mpt->dst);
+                       return false;
+               } else {
+                       PLOG_D("statvfs('%s')", mpt->dst);
+                       return true;
+               }
        }
        /*
         * It's fine to use 'flags | vfs.f_flag' here as per
@@ -206,10 +211,11 @@ static bool mountRemountRO(struct mounts_t *mpt)
              mountFlagsToStr(vfs.f_flag), mountFlagsToStr(new_flags));
 
        if (mount(mpt->dst, mpt->dst, NULL, new_flags, 0) == -1) {
-               PLOG_W("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
                if (mpt->mandatory) {
+                       PLOG_W("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
                        return false;
                }
+               PLOG_D("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
        }
 
        return true;