mount_root: check for preinit sentinel file
authorJohn Crispin <john@phrozen.org>
Sun, 15 May 2016 14:20:20 +0000 (16:20 +0200)
committerJohn Crispin <john@phrozen.org>
Sun, 15 May 2016 14:20:20 +0000 (16:20 +0200)
Signed-off-by: John Crispin <john@phrozen.org>
mount_root.c

index bf70265d45cc49568562e58ecfe6bd6cf41929be..6e06b45806e5e05ae660f7692a6a1585bd220ef4 100644 (file)
@@ -12,6 +12,9 @@
  */
 
 #include <sys/mount.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -29,8 +32,9 @@ start(int argc, char *argv[1])
 {
        struct volume *root;
        struct volume *data = volume_find("rootfs_data");
+       struct stat s;
 
-       if (!getenv("PREINIT"))
+       if (!getenv("PREINIT") && stat("/tmp/.preinit", &s))
                return -1;
 
        if (!data) {