From 81cc86e56a897fc3778e1ee806600bfce2af4311 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 4 Aug 2009 11:50:47 -0400 Subject: Fix ctrl-alt-deleter behavior /before/ end of install. The new reboot code didn't take into account the fact that there's a different sigint handler while anaconda is running vs when we're done installing. This patch fixes that bad assumption. --- loader/init.c | 1 + loader/init.h | 2 ++ loader/shutdown.c | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'loader') 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); -- cgit