Fix procd not handling rapid reboot signals very well
authorMichel Stam <m.stam@fugro.nl>
Thu, 2 Oct 2014 11:56:16 +0000 (11:56 +0000)
committerJohn Crispin <blogic@openwrt.org>
Thu, 2 Oct 2014 17:08:39 +0000 (19:08 +0200)
When keeping ctrl-alt-del pressed, or when running;
while true; do
    /sbin/reboot
done
effectively the procd shutdown cycle gets into an undefined state,

Signed-off-by: Michel Stam <m.stam@fugro.nl>
state.c

diff --git a/state.c b/state.c
index e5f0015..bba5966 100644 (file)
--- a/state.c
+++ b/state.c
@@ -94,6 +94,8 @@ void procd_state_next(void)
 
 void procd_shutdown(int event)
 {
+       if (state >= STATE_SHUTDOWN)
+               return;
        DEBUG(2, "Shutting down system with event %x\n", event);
        reboot_event = event;
        state = STATE_SHUTDOWN;