cvs: pecl /apc apc_cache.c apc_sma.c php_apc.c
| From: | Rasmus Lerdorf | Date: | Sat, 04 Sep 2004 14:33:13 +0000 |
| Subject: | cvs: pecl /apc apc_cache.c apc_sma.c php_apc.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1783@lists.php.net to get a copy of this message | ||
rasmus Sat Sep 4 10:33:13 2004 EDT
Modified files:
/pecl/apc apc_cache.c apc_sma.c php_apc.c
Log:
Avoid dumb crash when calling the info function with the cache disabled.
http://cvs.php.net/diff.php/pecl/apc/apc_cache.c?r1=3.60&r2=3.61&ty=u
Index: pecl/apc/apc_cache.c
diff -u pecl/apc/apc_cache.c:3.60 pecl/apc/apc_cache.c:3.61
--- pecl/apc/apc_cache.c:3.60 Fri Sep 3 13:44:52 2004
+++ pecl/apc/apc_cache.c Sat Sep 4 10:33:13 2004
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apc_cache.c,v 3.60 2004/09/03 17:44:52 rasmus Exp $ */
+/* $Id: apc_cache.c,v 3.61 2004/09/04 14:33:13 rasmus Exp $ */
#include "apc_cache.h"
#include "apc_lock.h"
@@ -235,6 +235,8 @@
{
int i;
+ if(!cache) return;
+
LOCK(cache);
cache->header->num_hits = 0;
@@ -427,6 +429,8 @@
apc_cache_info_t* info;
slot_t* p;
int i;
+
+ if(!cache) return NULL;
LOCK(cache);
http://cvs.php.net/diff.php/pecl/apc/apc_sma.c?r1=1.17&r2=1.18&ty=u
Index: pecl/apc/apc_sma.c
diff -u pecl/apc/apc_sma.c:1.17 pecl/apc/apc_sma.c:1.18
--- pecl/apc/apc_sma.c:1.17 Fri Aug 20 12:49:20 2004
+++ pecl/apc/apc_sma.c Sat Sep 4 10:33:13 2004
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apc_sma.c,v 1.17 2004/08/20 16:49:20 rasmus Exp $ */
+/* $Id: apc_sma.c,v 1.18 2004/09/04 14:33:13 rasmus Exp $ */
#include "apc_sma.h"
#include "apc.h"
@@ -350,6 +350,10 @@
apc_sma_info_t* info;
apc_sma_link_t** link;
int i;
+
+ if (!sma_initialized) {
+ return NULL;
+ }
info = (apc_sma_info_t*) apc_emalloc(sizeof(apc_sma_info_t));
info->num_seg = sma_numseg;
http://cvs.php.net/diff.php/pecl/apc/php_apc.c?r1=3.31&r2=3.32&ty=u
Index: pecl/apc/php_apc.c
diff -u pecl/apc/php_apc.c:3.31 pecl/apc/php_apc.c:3.32
--- pecl/apc/php_apc.c:3.31 Thu Aug 12 13:35:00 2004
+++ pecl/apc/php_apc.c Sat Sep 4 10:33:13 2004
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_apc.c,v 3.31 2004/08/12 17:35:00 rasmus Exp $ */
+/* $Id: php_apc.c,v 3.32 2004/09/04 14:33:13 rasmus Exp $ */
#ifdef PHP_WIN32
/* XXX lame hack, for some reason, the ini entries are all messed
@@ -108,7 +108,7 @@
#else
php_info_print_table_row(2, "MMAP Support", "Disabled");
#endif
- php_info_print_table_row(2, "Revision", "$Revision: 3.31 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 3.32 $");
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
DISPLAY_INI_ENTRIES();
php_info_print_table_end();
@@ -170,6 +170,10 @@
}
info = apc_cache_info(APCG(cache));
+ if(!info) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No APC info available. Perhaps APC is
disabled via apc.enabled?");
+ RETURN_FALSE;
+ }
array_init(return_value);
add_assoc_long(return_value, "num_slots", info->num_slots);
@@ -247,6 +251,10 @@
}
info = apc_sma_info();
+ if(!info) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No APC SMA info available. Perhaps APC
is disabled via apc.enabled?");
+ RETURN_FALSE;
+ }
array_init(return_value);
add_assoc_long(return_value, "num_seg", info->num_seg);
@@ -307,7 +315,6 @@
#ifdef COMPILE_DL_APC
ZEND_GET_MODULE(apc)
#endif
-
/* }}} */
/*