--- linux-2.4.19-pre8/./kernel/exit.c Tue May 7 09:18:14 2002 +++ linux-2.4.19-pre8-reparent/./kernel/exit.c Tue May 7 10:01:56 2002 @@ -152,7 +152,7 @@ /* * When we die, we re-parent all our children. - * Try to give them to another thread in our process + * Try to give them to another thread in our thread * group, and if no such member exists, give it to * the global child reaper process (ie "init") */ @@ -162,8 +162,14 @@ read_lock(&tasklist_lock); - /* Next in our thread group */ - reaper = next_thread(father); + /* Next in our thread group, if they're not already exiting */ + reaper = father; + do { + reaper = next_thread(reaper); + if (!(reaper->flags & PF_EXITING)) + break; + } while (reaper != father); + if (reaper == father) reaper = child_reaper;