chiark / gitweb /
nspawn, machine-id-setup: warn if read-only mount call fails
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 Mar 2013 20:33:55 +0000 (16:33 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 31 Mar 2013 18:32:48 +0000 (14:32 -0400)
They are not crucial, but they shouldn't fail.

src/core/machine-id-setup.c
src/nspawn/nspawn.c

index ca163978f39a885142dade4023c01f2192ed885a..146c5653c96af4b91ac12ed5b268684429136c3a 100644 (file)
@@ -235,7 +235,9 @@ int machine_id_setup(void) {
                 log_info("Installed transient /etc/machine-id file.");
 
                 /* Mark the mount read-only */
-                mount(NULL, "/etc/machine-id", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL);
+                if (mount(NULL, "/etc/machine-id", NULL,
+                          MS_BIND|MS_RDONLY|MS_REMOUNT, NULL) < 0)
+                        log_warning("Failed to make transient /etc/machine-id read-only");
         }
 
 finish:
index 9268cbc246c6797d9030de4ee4d4f3f1694e5cf4..b8b692b47462929f6b2fe75992141f290b48705d 100644 (file)
@@ -537,8 +537,8 @@ static int setup_boot_id(const char *dest) {
         if (mount(from, to, "bind", MS_BIND, NULL) < 0) {
                 log_error("Failed to bind mount boot id: %m");
                 r = -errno;
-        } else
-                mount(from, to, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
+        } else if (mount(from, to, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL))
+                log_warning("Failed to make boot id read-only: %m");
 
         unlink(from);
         return r;