cvs: php4 /sapi/apache2filter sapi_apache2.c

From: Date: Sun, 05 May 2002 18:11:41 +0000
Subject: cvs: php4 /sapi/apache2filter sapi_apache2.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11713@lists.php.net to get a copy of this message
aaron Sun May 5 14:11:41 2002 EDT Modified files: /php4/sapi/apache2filter sapi_apache2.c Log: Fix an elusive and intermittent startup SEGV. The problem was the static string we were using to set an initialization flag would get remapped to a different location when Apache reloaded the DSO, causing us to not run our initialization routines. Submitted by: Justin Erenkrantz <jerenkrantz@apache.org> Reviewed by: Aaron Bannert (I added the big comment too) Index: php4/sapi/apache2filter/sapi_apache2.c diff -u php4/sapi/apache2filter/sapi_apache2.c:1.74 php4/sapi/apache2filter/sapi_apache2.c:1.75 --- php4/sapi/apache2filter/sapi_apache2.c:1.74 Tue Apr 23 20:55:38 2002 +++ php4/sapi/apache2filter/sapi_apache2.c Sun May 5 14:11:41 2002 @@ -454,14 +454,19 @@ * prevents us from starting PHP until the second load. */ apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (data == NULL) { - apr_pool_userdata_setn((const void *)1, userdata_key, - apr_pool_cleanup_null, s->process->pool); + /* We must use set() here and *not* setn(), otherwise the + * static string pointed to by userdata_key will be mapped + * to a different location when the DSO is reloaded and the + * pointers won't match, causing get() to return NULL when + * we expected it to return non-NULL. */ + apr_pool_userdata_set((const void *)1, userdata_key, + apr_pool_cleanup_null, s->process->pool); return OK; } else if (data == (const void *)2) { return OK; } - apr_pool_userdata_setn((const void *)2, userdata_key, + apr_pool_userdata_set((const void *)2, userdata_key, apr_pool_cleanup_null, s->process->pool); /* Set up our overridden path. */

« previous php.cvs (#11713) next »