chiark / gitweb /
nspawn, machine-id-setup: warn if read-only mount call fails
[elogind.git] / src / core / machine-id-setup.c
index 7f4c23b13004c2beffb546e097c1fd5e1462fa24..146c5653c96af4b91ac12ed5b268684429136c3a 100644 (file)
@@ -35,6 +35,7 @@
 #include "mkdir.h"
 #include "log.h"
 #include "virt.h"
+#include "fileio.h"
 
 static int shorten_uuid(char destination[36], const char *source) {
         unsigned i, j;
@@ -234,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: