#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mount.h>
+#include <fcntl.h>
#include <libubox/uloop.h>
#include <libubox/utils.h>
if (!fp)
return;
- fscanf(fp, "%d", &lvl);
+ if (fscanf(fp, "%d", &lvl) == EOF)
+ ERROR("failed to read debug level\n");
fclose(fp);
unlink("/tmp/debug_level");
unsetenv("INITRAMFS");
unsetenv("PREINIT");
+ unlink("/tmp/.preinit");
DEBUG(2, "Exec to real procd now\n");
if (wdt_fd)
setenv("WDTFD", wdt_fd, 1);
{
char *init[] = { "/bin/sh", "/etc/preinit", NULL };
char *plug[] = { "/sbin/procd", "-h", "/etc/hotplug-preinit.json", NULL };
+ int fd;
LOG("- preinit -\n");
setenv("PREINIT", "1", 1);
+ fd = creat("/tmp/.preinit", 0600);
+
+ if (fd < 0)
+ ERROR("Failed to create sentinel file\n");
+ else
+ close(fd);
+
preinit_proc.cb = spawn_procd;
preinit_proc.pid = fork();
if (!preinit_proc.pid) {