Subject: Re: Allow pkill races without aborting?
To: None <tech-userlevel@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-userlevel
Date: 07/17/2005 12:29:11
Dave Sainty wrote:
[...]
> However, an exit level of 1 seems appropriate if pkill never matches a
> process that it successfully signalled (or, indeed, if pgrep never
> matches a process that it successfully output).
>
> So, I suggest the following patch:
This sounds very reasonable to me.
> + if (kill(kp->p_pid, signum) == -1) {
> + if (errno == ESRCH)
> + /*
> + * The process disappeared between us matching
> + * it and us signalling it. Return 0 to
> + * indicate that the process should not be
> + * considered a match.
> + */
> + return 0;
Could you please but braces around the comment and the return? (twice)
Roland