do not fail build if MAXSYMLINKS isn't defined
[oweals/busybox.git] / init / init.c
index cc6a2b5be5e7c35a08d8948fc479c3990c7ce618..d29328c36f9a801af03a5ff403746fe9c41c74a0 100644 (file)
@@ -222,8 +222,8 @@ static void message(int where, const char *fmt, ...)
        msg[0] = '\r';
        va_start(arguments, fmt);
        l = 1 + vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments);
-       if (l > sizeof(msg) - 1)
-               l = sizeof(msg) - 1;
+       if (l > sizeof(msg) - 2)
+               l = sizeof(msg) - 2;
        va_end(arguments);
 
 #if ENABLE_FEATURE_INIT_SYSLOG
@@ -789,7 +789,7 @@ static void run_shutdown_and_kill_processes(void)
  * and only one will be remembered and acted upon.
  */
 
-/* The SIGUSR[12]/SIGTERM handler */
+/* The SIGPWR/SIGUSR[12]/SIGTERM handler */
 static void halt_reboot_pwoff(int sig) NORETURN;
 static void halt_reboot_pwoff(int sig)
 {
@@ -1103,8 +1103,8 @@ int init_main(int argc UNUSED_PARAM, char **argv)
 
                /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
                 * then parse_inittab() simply adds in some default
-                * actions(i.e., INIT_SCRIPT and a pair
-                * of "askfirst" shells */
+                * actions (i.e., INIT_SCRIPT and a pair
+                * of "askfirst" shells) */
                parse_inittab();
        }
 
@@ -1128,13 +1128,14 @@ int init_main(int argc UNUSED_PARAM, char **argv)
        strncpy(argv[0], "init", strlen(argv[0]));
        /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */
        while (*++argv)
-               memset(*argv, 0, strlen(*argv));
+               nuke_str(*argv);
 
        /* Set up signal handlers */
        if (!DEBUG_INIT) {
                struct sigaction sa;
 
                bb_signals(0
+                       + (1 << SIGPWR)  /* halt */
                        + (1 << SIGUSR1) /* halt */
                        + (1 << SIGTERM) /* reboot */
                        + (1 << SIGUSR2) /* poweroff */