[PATCH] Fix ctrl-alt-deleter behavior /before/ end of install.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

diff --git a/loader/init.c b/loader/init.c
index ff0f62e..8037de0 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 733bc8e..413c8ba 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 54fd9a5..5ba8fc6 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);
-- 
1.6.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux