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! ;) ]
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;
}