diff options
Diffstat (limited to 'loader')
-rw-r--r-- | loader/init.c | 1 | ||||
-rw-r--r-- | loader/init.h | 2 | ||||
-rw-r--r-- | loader/shutdown.c | 8 |
3 files changed, 8 insertions, 3 deletions
diff --git a/loader/init.c b/loader/init.c index ff0f62ef8..8037de0a8 100644 --- a/loader/init.c +++ b/loader/init.c @@ -395,6 +395,7 @@ static void termReset(void) { /* reboot handler */ static void sigintHandler(int signum) { termReset(); + shouldReboot = 1; shutDown(getKillPolicy(), REBOOT); } diff --git a/loader/init.h b/loader/init.h index 733bc8e68..413c8ba3c 100644 --- a/loader/init.h +++ b/loader/init.h @@ -25,4 +25,6 @@ typedef enum { HALT } reboot_action; +extern int shouldReboot; + #endif /* INIT_H */ diff --git a/loader/shutdown.c b/loader/shutdown.c index 54fd9a53b..5ba8fc64b 100644 --- a/loader/shutdown.c +++ b/loader/shutdown.c @@ -85,7 +85,7 @@ static void performReboot(reboot_action rebootAction) { } } -static int shouldReboot = 0; +int shouldReboot = 0; static void rebootHandler(int signum) { shouldReboot = 1; @@ -98,16 +98,18 @@ void shutDown(int doKill, reboot_action rebootAction) { if (!doKill) performReboot(rebootAction); } + + if (!shouldReboot && rebootAction != REBOOT) + printf("you may safely reboot your system\n"); - printf("you may safely reboot your system\n"); signal(SIGINT, rebootHandler); while (1) { - sleep(1); if (shouldReboot) { performUnmounts(1); performTerminations(1); performReboot(REBOOT); } + sleep(1); } exit(0); |