aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index fd0e067952ab..03e64fe4a14a 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -189,21 +189,18 @@ repeat:
189int session_of_pgrp(int pgrp) 189int session_of_pgrp(int pgrp)
190{ 190{
191 struct task_struct *p; 191 struct task_struct *p;
192 int sid = -1; 192 int sid = 0;
193 193
194 read_lock(&tasklist_lock); 194 read_lock(&tasklist_lock);
195 do_each_task_pid(pgrp, PIDTYPE_PGID, p) { 195
196 if (process_session(p) > 0) { 196 p = find_task_by_pid_type(PIDTYPE_PGID, pgrp);
197 sid = process_session(p); 197 if (p == NULL)
198 goto out; 198 p = find_task_by_pid(pgrp);
199 } 199 if (p != NULL)
200 } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
201 p = find_task_by_pid(pgrp);
202 if (p)
203 sid = process_session(p); 200 sid = process_session(p);
204out: 201
205 read_unlock(&tasklist_lock); 202 read_unlock(&tasklist_lock);
206 203
207 return sid; 204 return sid;
208} 205}
209 206