[OpenWrt-Devel] [PATCH procd 1/8] Fix procd not handling rapid reboot signals very well

Michel Stam m.stam at fugro.nl
Thu Oct 2 08:56:16 EDT 2014


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 at 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 at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list