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.s...@fugro.nl>
---
 state.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/state.c b/state.c
index e5f0015..2de32e1 100644
--- a/state.c
+++ b/state.c
@@ -94,8 +94,10 @@ void procd_state_next(void)
 
 void procd_shutdown(int event)
 {
-       DEBUG(2, "Shutting down system with event %x\n", event);
-       reboot_event = event;
-       state = STATE_SHUTDOWN;
-       state_enter();
+       if (state < STATE_SHUTDOWN) {
+               DEBUG(2, "Shutting down system with event %x\n", event);
+               reboot_event = event;
+               state = STATE_SHUTDOWN;
+               state_enter();
+       }
 }
-- 
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