make procd handle ctrl+alt+del
authorJohn Crispin <blogic@openwrt.org>
Thu, 2 Oct 2014 17:39:56 +0000 (19:39 +0200)
committerJohn Crispin <blogic@openwrt.org>
Thu, 2 Oct 2014 17:49:05 +0000 (19:49 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
procd.c
signal.c

diff --git a/procd.c b/procd.c
index ad8028441d597b2c806074b242ee52fa89463605..f5640c3b968a607f6c2321c27da787562defcc82 100644 (file)
--- a/procd.c
+++ b/procd.c
@@ -15,6 +15,7 @@
 #include <sys/wait.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/reboot.h>
 
 #include <unistd.h>
 #include <getopt.h>
@@ -69,6 +70,10 @@ int main(int argc, char **argv)
        else
                procd_state_next();
        uloop_run();
+       uloop_done();
+
+       if (getpid() == 1)
+               procd_shutdown(RB_AUTOBOOT);
 
        return 0;
 }
index 74cabcbaf13c829f8be119a700a831860bb7796f..12eedc8ca976bc8a28940097d4af90cd2bda133a 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -91,4 +91,5 @@ void procd_signal(void)
        sigaction(SIGHUP, &sa_dummy, NULL);
        sigaction(SIGKILL, &sa_dummy, NULL);
        sigaction(SIGSTOP, &sa_dummy, NULL);
+       reboot(RB_DISABLE_CAD);
 }