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

[PATCH] Properly restore SIGCHLD if X startup fails



Before starting X we set up a SIGCHLD handler to raise OSError if
Xorg dies. But if that happens, we'll skip over the code that
restores the old SIGCHLD handler, and thus the next subprocess we
run will cause anaconda to catch OSError and die.

This patch moves the signal restore code into a finally: block.
---
 anaconda |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/anaconda b/anaconda
index bc5ed45..5e8d6ce 100755
--- a/anaconda
+++ b/anaconda
@@ -833,9 +833,9 @@ if __name__ == "__main__":
 	    def preexec_fn():
 		signal.signal(signal.SIGUSR1, signal.SIG_IGN)
 
-            xout = open("/dev/tty5", "w")
 	    old_sigusr1 = signal.signal(signal.SIGUSR1, sigusr1_handler)
 	    old_sigchld = signal.signal(signal.SIGCHLD, sigchld_handler)
+            xout = open("/dev/tty5", "w")
 
             proc = subprocess.Popen(["Xorg", "-br", "-logfile", "/tmp/X.log",
 				     ":1", "vt6", "-s", "1440", "-ac",
@@ -845,9 +845,6 @@ if __name__ == "__main__":
 
 	    signal.pause()
 
-	    signal.signal(signal.SIGUSR1, old_sigusr1)
-	    signal.signal(signal.SIGCHLD, old_sigchld)
-
             os.environ["DISPLAY"] = ":1"
             doStartupX11Actions(opts.runres)
             xserver_pid = proc.pid
@@ -856,6 +853,9 @@ if __name__ == "__main__":
             opts.display_mode = 't'
             graphical_failed = 1
             time.sleep(2)
+        finally:
+	    signal.signal(signal.SIGUSR1, old_sigusr1)
+	    signal.signal(signal.SIGCHLD, old_sigchld)
 
     if opts.display_mode == 't' and graphical_failed and not anaconda.isKickstart:
         ret = vnc.askVncWindow()
-- 
1.6.2.2


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