[patch] pgrp-fix-2.5.38-A2

Ingo Molnar (mingo@elte.hu)
Tue, 24 Sep 2002 11:06:51 +0200 (CEST)


the attached patch, against BK-curr, 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! ;) ]

Ingo

--- linux/kernel/exit.c.orig Tue Sep 24 10:29:09 2002
+++ linux/kernel/exit.c Tue Sep 24 10:58:40 2002
@@ -131,9 +131,14 @@
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;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/