]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] pgrp-fix-2.5.38-A2
authorIngo Molnar <mingo@elte.hu>
Tue, 24 Sep 2002 01:40:37 +0000 (18:40 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 24 Sep 2002 01:40:37 +0000 (18:40 -0700)
This fixes the emacs bug reported by Andries.  It should probably also
fix other, terminal handling related weirdnesses introduced by the new
PID handling code in 2.5.38.

The bug was in the session_of_pgrp() function, if no proper session is
found in the process group then we must take the session ID from the
process that has pgrp PID (which does not necesserily have to be part of
the pgrp).  The fallback code is only triggered when no process in the
process group has a valid session - besides being faster, this also
matches the old implementation.

[ hey, who needs a POSIX conformance testsuite when we have emacs! ;) ]

kernel/exit.c

index 6b1629ef433afbc1ed04db535218c1c8456cb619..fe11fa9297465dcd99800cdc64836211e19f3fcc 100644 (file)
@@ -131,9 +131,14 @@ int session_of_pgrp(int pgrp)
        for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid)
                if (p->session > 0) {
                        sid = p->session;
-                       break;
+                       goto out;
                }
+       p = find_task_by_pid(pgrp);
+       if (p)
+               sid = p->session;
+out:
        read_unlock(&tasklist_lock);
+       
        return sid;
 }