diff -NurpP --minimal linux-2.4.25-rc1-vs1.3.7/kernel/exit.c linux-2.4.25-rc1-vs1.3.7.1.y/kernel/exit.c --- linux-2.4.25-rc1-vs1.3.7/kernel/exit.c 2004-02-09 12:43:48.000000000 +0100 +++ linux-2.4.25-rc1-vs1.3.7.1.y/kernel/exit.c 2004-02-14 03:14:47.000000000 +0100 @@ -178,11 +178,12 @@ static inline void forget_original_paren { struct task_struct * p; struct task_struct *vchild_reaper = child_reaper; + pid_t initpid = 1; read_lock(&tasklist_lock); if (father->vx_info) { - pid_t initpid = father->vx_info->vx_initpid; - if ((initpid != 0) && (father->pid != initpid)) { + initpid = father->vx_info->vx_initpid; + if (initpid && (father->pid != initpid)) { struct task_struct *r = find_task_by_pid(initpid); if (r != NULL) @@ -178,16 +178,22 @@ static inline void forget_original_paren } for_each_task(p) { - if (p->p_opptr == father) { - /* We dont want people slaying init */ - p->exit_signal = SIGCHLD; - p->self_exec_id++; + if (p->p_opptr != father) + continue; + /* We dont want people slaying init */ + p->exit_signal = SIGCHLD; + p->self_exec_id++; - /* Make sure we're not reparenting to ourselves */ + /* Make sure we're not reparenting to ourselves */ + if (p != vchild_reaper) p->p_opptr = vchild_reaper; - - if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0); + else { + /* should become parent reaper ;) */ + p->p_opptr = child_reaper; } + + if (p->pdeath_signal) + send_sig(p->pdeath_signal, p, 0); } read_unlock(&tasklist_lock); }