httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: [PATCH] pid safety checks for 2.2.x
Date Wed, 27 Jun 2007 19:38:10 GMT


On 06/27/2007 07:52 PM, Joe Orton wrote:


> Index: server/mpm_common.c
> ===================================================================
> --- server/mpm_common.c	(revision 549489)
> +++ server/mpm_common.c	(working copy)
> @@ -305,6 +305,27 @@
>          cur_extra = next;
>      }
>  }
> +
> +apr_status_t ap_mpm_safe_kill(pid_t pid, int sig)
> +{
> +    apr_proc_t proc;
> +    apr_status_t waitret;
> +
> +    /* Ensure the given pid is greater than zero; passing waitpid() a
> +     * zero or negative pid has different semantics. */

Ok, it seems as I am trying to become the king of all nitpickers :-):

Style of comment.

> +    if (pid < 1) {
> +        return APR_EINVAL;
> +    }
> +
> +    proc.pid = pid;
> +    waitret = apr_proc_wait(&proc, NULL, NULL, APR_NOWAIT);
> +    if (waitret == APR_CHILD_NOTDONE) {
> +        return kill(pid, sig) ? errno : APR_SUCCESS;
> +    }
> +    else {
> +        return APR_EINVAL;

Hm. Wouldn't it make sense to log this in the case

waitret != APR_CHILD_DONE

as in the PID table patches?
This could give the admin a hint that something is rotten on his box.

Regards

RĂ¼diger



Mime
View raw message