httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: [PATCH] fix setjmp in perchild
Date Wed, 19 Dec 2001 01:44:32 GMT
Aaron Bannert <aaron@clove.org> writes:

> My setjmp man page on Linux says it returns zero or non-zero, so is
> this patch more correct?

My Linux setjmp() man page is pretty poor w.r.t. the return value

> Index: server/mpm/perchild/perchild.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v
> retrieving revision 1.93
> diff -u -u -r1.93 perchild.c
> --- server/mpm/perchild/perchild.c	2001/12/19 01:22:03	1.93
> +++ server/mpm/perchild/perchild.c	2001/12/19 01:22:21
> @@ -807,7 +807,7 @@
>                  thread_socket_table[thread_num] = dp;
>                  apr_os_sock_put(&csd, &child_info_table[child_num].sd, ptrans);
>              }
> -            if (setjmp(jmpbuffer) != 1) {
> +            if (!setjmp(jmpbuffer)) {
>                  process_socket(ptrans, csd, conn_id);
>              }


setjmp() returns

0                 initial setup
1                 if 2nd parameter to longjmp() is 0 or 1
n                 if 2nd parameter to longjmp() is n

Since perchild passes 1 as second parameter to longjmp(), the original
"if setjmp() != 1" says "if I didn't longjmp() here".

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message