add missing includes
[project/procd.git] / initd / init.c
index 0d201bc..e453cff 100644 (file)
@@ -72,6 +72,8 @@ main(int argc, char **argv)
 {
        pid_t pid;
 
+       ulog_open(ULOG_KMSG, LOG_DAEMON, "init");
+
        sigaction(SIGTERM, &sa_shutdown, NULL);
        sigaction(SIGUSR1, &sa_shutdown, NULL);
        sigaction(SIGUSR2, &sa_shutdown, NULL);
@@ -84,17 +86,9 @@ main(int argc, char **argv)
        if (!pid) {
                char *kmod[] = { "/sbin/kmodloader", "/etc/modules-boot.d/", NULL };
 
-               if (debug < 3) {
-                       int fd = open("/dev/null", O_RDWR);
+               if (debug < 3)
+                       patch_stdio("/dev/null");
 
-                       if (fd > -1) {
-                               dup2(fd, STDIN_FILENO);
-                               dup2(fd, STDOUT_FILENO);
-                               dup2(fd, STDERR_FILENO);
-                               if (fd > STDERR_FILENO)
-                                       close(fd);
-                       }
-               }
                execvp(kmod[0], kmod);
                ERROR("Failed to start kmodloader\n");
                exit(-1);
@@ -104,10 +98,10 @@ main(int argc, char **argv)
        } else {
                int i;
 
-               for (i = 0; i < 120; i++) {
+               for (i = 0; i < 1200; i++) {
                        if (waitpid(pid, NULL, WNOHANG) > 0)
                                break;
-                       sleep(1);
+                       usleep(10 * 1000);
                        watchdog_ping();
                }
        }