--- ./fs/exec.c.dewr	2006-07-06 11:59:20.000000000 +0400
+++ ./fs/exec.c	2006-07-19 09:16:17.000000000 +0400
@@ -711,7 +711,7 @@ static inline int de_thread(struct task_
 	if (current->pid != current->tgid) {
 		struct task_struct *parent;
 		struct dentry *proc_dentry1[2], *proc_dentry2[2];
-		unsigned long exit_state, ptrace;
+		unsigned long ptrace;
 
 		/*
 		 * Wait for the thread group leader to be a zombie.
@@ -763,16 +763,14 @@ static inline int de_thread(struct task_
 		list_del(&current->tasks);
 		list_add_tail(&current->tasks, &init_task.tasks);
 		current->exit_signal = SIGCHLD;
-		exit_state = leader->exit_state;
+		BUG_ON(leader->exit_state != EXIT_ZOMBIE);
+		leader->exit_state = EXIT_DEAD;
 
 		write_unlock_irq(&tasklist_lock);
 		spin_unlock(&leader->proc_lock);
 		spin_unlock(&current->proc_lock);
 		proc_pid_flush(proc_dentry1);
 		proc_pid_flush(proc_dentry2);
-
-		if (exit_state != EXIT_ZOMBIE)
-			BUG();
         }
 
 	/*
