[EMAIL PROTECTED] writes:
> jerenkrantz 01/09/21 09:14:50
>
> Modified: . CHANGES
> threadproc/unix proc.c
> Log:
> Simplify apr_proc_wait_all_procs and consolidate apr_proc_wait.
>
> Index: proc.c
> diff -u -r1.48 -r1.49
> --- proc.c 2001/09/20 08:59:31 1.48
> +++ proc.c 2001/09/21 16:14:50 1.49
...
> APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
> @@ -384,18 +375,24 @@
> apr_wait_how_e waithow)
> {
> pid_t pstatus;
> + int waitpid_options = WUNTRACED;
> + int exit_int;
>
> - if (waithow == APR_WAIT) {
> - if ((pstatus = waitpid(proc->pid, exitcode, WUNTRACED)) > 0) {
> - return APR_CHILD_DONE;
> + if (waithow != APR_WAIT) {
> + waitpid_options |= WNOHANG;
> + }
> +
> + if ((pstatus = waitpid(proc->pid, &exit_int, waitpid_options)) > 0) {
> + if (proc->pid == -1) {
> + proc->pid = pstatus;
> }
> - else if (pstatus == 0) {
> - return APR_CHILD_NOTDONE;
> + if (WIFEXITED(exit_int)) {
> + if (exitcode != NULL) {
> + *exitcode = WEXITSTATUS(exit_int);
> + }
no!!!!!!! Because of this, we're returning APR_CHILD_NOTDONE when a
child exits due to a signal (like SIGSEGV)... thus Apache isn't able
to see that the segfault happened and the log message is broken.
The old code had this correct. If waitpid() returns >0, a child has
finished. The WIF...() macros are just to find out how it finished
(it chose to exit -- WIFEXITED, it got a signal -- WIFSIGNALED()).
--
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...