Commit 46385763 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] __kill_pg_info() return value fix

Fix a bug which was spotted by Alex Lyashkov <shadow@psoft.net>

The fairly unobvious coding in __kill_pg_info() will cause a zero value to be
incorrectly returned if the second or succeeding call to
group_send_sig_info() returns an error.
parent 51fb5c51
......@@ -1051,17 +1051,23 @@ int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
struct task_struct *p;
struct list_head *l;
struct pid *pid;
int err, retval = -ESRCH;
int retval;
int found;
if (pgrp <= 0)
return -EINVAL;
found = 0;
retval = 0;
for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid) {
int err;
found = 1;
err = group_send_sig_info(sig, info, p);
if (retval)
if (!retval)
retval = err;
}
return retval;
return found ? retval : -ESRCH;
}
int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment