sas Tue Dec 3 16:50:13 2002 EDT
Modified files:
/php4/ext/ircg ircg.c php_ircg_private.h
Log:
Ensure that a terminating Apache child does not destroy our globally
shared locks and data structures.
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.151 php4/ext/ircg/ircg.c:1.152
--- php4/ext/ircg/ircg.c:1.151 Tue Dec 3 09:14:33 2002
+++ php4/ext/ircg/ircg.c Tue Dec 3 16:50:12 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ircg.c,v 1.151 2002/12/03 14:14:33 sas Exp $ */
+/* $Id: ircg.c,v 1.152 2002/12/03 21:50:12 sas Exp $ */
/* {{{ includes */
@@ -2132,6 +2132,8 @@
}
}
+static pid_t initialized_from;
+
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(ircg)
@@ -2152,6 +2154,8 @@
}
#endif
+ initialized_from = getpid();
+
#if IRCG_API_VERSION >= 20021127
ircg_setup_global("/tmp/ircg.lock", 0, setup);
#else
@@ -2174,7 +2178,6 @@
*/
PHP_MSHUTDOWN_FUNCTION(ircg)
{
- ircg_hash_destroy(&php_ircg->h_fmt_msgs);
#ifdef USE_IRCONN_MANAGEMENT
ircg_hash_destroy(&h_irconn);
#endif
@@ -2182,10 +2185,14 @@
ircg_hash_destroy(&h_fd2irconn);
#endif
- IRCG_LOCK_DESTROY(php_ircg->fmt_msgs_lock);
- IRCG_LOCK_DESTROY(php_ircg->error_msgs_lock);
+ if (getpid() == initialized_from) {
+ ircg_hash_destroy(&php_ircg->h_fmt_msgs);
- ircg_shutdown_global();
+ IRCG_LOCK_DESTROY(php_ircg->fmt_msgs_lock);
+ IRCG_LOCK_DESTROY(php_ircg->error_msgs_lock);
+
+ ircg_shutdown_global();
+ }
return SUCCESS;
}
Index: php4/ext/ircg/php_ircg_private.h
diff -u php4/ext/ircg/php_ircg_private.h:1.2 php4/ext/ircg/php_ircg_private.h:1.3
--- php4/ext/ircg/php_ircg_private.h:1.2 Tue Dec 3 09:14:33 2002
+++ php4/ext/ircg/php_ircg_private.h Tue Dec 3 16:50:12 2002
@@ -20,6 +20,8 @@
#include <ircg_lock.h>
#endif
+#include "php_ircg_error.h"
+
struct php_ircg_global {
ircg_hash_table h_fmt_msgs;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php