[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230814154351.GA4203@redhat.com>
Date: Mon, 14 Aug 2023 17:43:51 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Petr Skocik <pskocik@...il.com>, Kees Cook <keescook@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Marco Elver <elver@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists