[PATCH] Get the ownership of terminal in stage2 (#716920)

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

 



This patch fixes the freeze in stage2. There is possible race though as I'm not
sure about the behaviour in the following case:

loader forks and execs stage2
loader sets the pgrp for stage2
stage2 get to the first stdio read
... freeze? kernel stops stage2 process
loader sets the pgrp for it's tty
... does kernel unfreezes stage2 and lets it continue?

This might also break our advanced debugging stuff, but we need the text mode
to work first so that case might get handled when we get that problem. 

---
 loader/loader.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index c1ee607..3e5f6b5 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2518,8 +2518,6 @@ int main(int argc, char ** argv) {
     printf(fmt, VERSION, getProductName());
 
     if (!(pid = fork())) {
-        /* Create a new process group that we can easily kill off later. */
-        setpgid(0, 0);
         /* This is where the Anaconda python process is started. */
         if (execv(anacondaArgs[0], anacondaArgs) == -1) {
            fprintf(stderr,"exec of anaconda failed: %m\n");
@@ -2527,6 +2525,12 @@ int main(int argc, char ** argv) {
         }
     }
 
+    /* Create a new process group that we can easily kill off later. */
+    setpgid(pid, 0);
+        
+    /* and transfer the terminal under it's control */
+    tcsetpgrp(0, getpgid(pid));
+
     waitpid(pid, &status, 0);
 
     if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status))) {
-- 
1.7.4.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