Procd, up until now, did not support the ctrlaltdel handler. Thus,
the system would immediately reboot upon the three-finger salute,
and no shutdown scripts would be run. This patch adds the handler
for the /etc/inittab entry, so that /sbin/reboot can be run and
in turn the shutdown scripts can be invoked.

Signed-off-by: Michel Stam <m.s...@fugro.nl>
---
 procd.c  | 1 +
 signal.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/procd.c b/procd.c
index ad80284..6ec7cd0 100644
--- a/procd.c
+++ b/procd.c
@@ -62,6 +62,7 @@ int main(int argc, char **argv)
                }
        }
        uloop_init();
+       uloop_release_sigint();
        procd_signal();
        trigger_init();
        if (getpid() != 1)
diff --git a/signal.c b/signal.c
index 74cabcb..6c00fd9 100644
--- a/signal.c
+++ b/signal.c
@@ -36,6 +36,7 @@ static void signal_shutdown(int signal, siginfo_t *siginfo, 
void *data)
        char *msg = NULL;
 
        switch(signal) {
+       case SIGINT:
        case SIGTERM:
                event = RB_AUTOBOOT;
                msg = "reboot";
@@ -91,4 +92,6 @@ void procd_signal(void)
        sigaction(SIGHUP, &sa_dummy, NULL);
        sigaction(SIGKILL, &sa_dummy, NULL);
        sigaction(SIGSTOP, &sa_dummy, NULL);
+       sigaction(SIGINT, &sa_shutdown, NULL);
+       reboot(RB_DISABLE_CAD);
 }
-- 
1.7.12.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to