lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] signal: Fix the error return of kill -1
On 08/14, Oleg Nesterov wrote:
>
> Why do we need the "bool found" variable ? Afacis
>
> } else {
> bool success = false;
> int retval = -ESRCH;
> struct task_struct * p;
>
> for_each_process(p) {
> if (task_pid_vnr(p) > 1 &&
> !same_thread_group(p, current)) {
> int err = group_send_sig_info(sig, info, p,
> PIDTYPE_MAX);
> success |= !err;
> retval = err;
> }
> }
> ret = success ? 0 : retval;
> }
>
> does the same?

Even simpler

} else {
struct task_struct * p;
bool success = false;
int err = -ESRCH;

for_each_process(p) {
if (task_pid_vnr(p) > 1 &&
!same_thread_group(p, current)) {
err = group_send_sig_info(sig, info, p,
PIDTYPE_MAX);
success |= !err;
}
}
ret = success ? 0 : err;
}

unless I missed something...

Oleg.

\
 
 \ /
  Last update: 2023-08-14 17:46    [W:0.148 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site