init: hopefully fix "rebooting" in containers

function                                             old     new   delta
pause_and_low_level_reboot                            48      57      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-09-22 19:30:40 +02:00
parent 1303962957
commit 426aff88a0

View File

@ -752,8 +752,13 @@ static void pause_and_low_level_reboot(unsigned magic)
reboot(magic); reboot(magic);
_exit(EXIT_SUCCESS); _exit(EXIT_SUCCESS);
} }
while (1) /* Used to have "while (1) sleep(1)" here.
sleep(1); * 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) static void run_shutdown_and_kill_processes(void)