+}
+
+static void exec_signal(int sig ATTRIBUTE_UNUSED)
+{
+ struct init_action *a, *tmp;
+ sigset_t unblock_signals;
+
+ for (a = init_action_list; a; a = tmp) {
+ tmp = a->next;
+ if (a->action & RESTART) {
+ shutdown_system();
+
+ /* unblock all signals, blocked in shutdown_system() */
+ sigemptyset(&unblock_signals);
+ sigaddset(&unblock_signals, SIGHUP);
+ sigaddset(&unblock_signals, SIGQUIT);
+ sigaddset(&unblock_signals, SIGCHLD);
+ sigaddset(&unblock_signals, SIGUSR1);
+ sigaddset(&unblock_signals, SIGUSR2);
+ sigaddset(&unblock_signals, SIGINT);
+ sigaddset(&unblock_signals, SIGTERM);
+ sigaddset(&unblock_signals, SIGCONT);
+ sigaddset(&unblock_signals, SIGSTOP);
+ sigaddset(&unblock_signals, SIGTSTP);
+ sigprocmask(SIG_UNBLOCK, &unblock_signals, NULL);
+
+ /* Close whatever files are open. */
+ close(0);
+ close(1);
+ close(2);
+
+ /* Open the new terminal device */
+ open_new_terminal(a->terminal, 0);
+
+ /* Make sure the terminal will act fairly normal for us */
+ set_term();
+ /* Setup stdout, stderr on the supplied terminal */
+ dup(0);
+ dup(0);
+
+ messageD(CONSOLE | LOG, "Trying to re-exec %s", a->command);
+ execl(a->command, a->command, NULL);
+
+ message(CONSOLE | LOG, "exec of '%s' failed: %m",
+ a->command);
+ sync();
+ sleep(2);
+ init_reboot(RB_HALT_SYSTEM);
+ loop_forever();
+ }