[git commit] init: hopefully fix "rebooting" in containers

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 22 17:30:40 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=426aff88a0802b8da18292079f60f56388d0cdad
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
pause_and_low_level_reboot                            48      57      +9

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 init/init.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/init/init.c b/init/init.c
index 6439e2bcd..fde35f6b6 100644
--- a/init/init.c
+++ b/init/init.c
@@ -752,8 +752,13 @@ static void pause_and_low_level_reboot(unsigned magic)
 		reboot(magic);
 		_exit(EXIT_SUCCESS);
 	}
-	while (1)
-		sleep(1);
+	/* Used to have "while (1) sleep(1)" here.
+	 * However, in containers reboot() call is ignored, and with that loop
+	 * we would eternally sleep here - not what we want.
+	 */
+	waitpid(pid, NULL, 0);
+	sleep(1); /* paranoia */
+	_exit(EXIT_SUCCESS);
 }
 
 static void run_shutdown_and_kill_processes(void)


More information about the busybox-cvs mailing list