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

[PATCH 3/3] Handle reboot better on s390 (#533198)



Do not install a handler for SIGINT on s390 since you can't really press
Ctrl+Alt+Del there.  Only handle SIGUSR1 and SIGUSR2 as handled in
linuxrc.s390 (which comes from loader which comes from iutil.py).
Always make sure we unmount filesystems and kill off processes, then
reboot if that's requested or exit and display the halt message.
---
 loader/shutdown.c |   29 ++++++-----------------------
 1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/loader/shutdown.c b/loader/shutdown.c
index 8f2c55e..7ab8195 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -84,36 +84,19 @@ static void performReboot(reboot_action rebootAction) {
 	}
 }
 
-int shouldReboot = 0;
-
-static void rebootHandler(int signum) {
-    shouldReboot = 1;
-}
-
 void shutDown(int doKill, reboot_action rebootAction) {
-	if (rebootAction == POWEROFF || rebootAction == REBOOT) {
+	if (doKill) {
 		performUnmounts(doKill);
 		performTerminations(doKill);
-		if (doKill)
-			performReboot(rebootAction);
 	}
 
-	if (!shouldReboot && rebootAction != REBOOT)
-		printf("you may safely reboot your system\n");
-	
-    signal(SIGINT, rebootHandler);
-	while (1) {
-		if (shouldReboot) {
-			performUnmounts(1);
-			performTerminations(1);
-			performReboot(REBOOT);
-		}
-		sleep(1);
+	if ((rebootAction == POWEROFF || rebootAction == REBOOT) && doKill) {
+		performReboot(rebootAction);
 	}
 
-    exit(0);
-
-    return;
+	printf("you may safely reboot your system\n");
+	exit(0);
+	return;
 }
 
 #ifdef AS_SHUTDOWN
-- 
1.6.6


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