[PATCH] APC / Clear dev/inode info for FPFILE entries
| From: | Francois Laupretre | Date: | Sat, 24 Nov 2007 11:12:04 +0000 |
| Subject: | [PATCH] APC / Clear dev/inode info for FPFILE entries | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-4930@lists.php.net to get a copy of this message | ||
Hi,
Here is a small patch correcting the invalid device/inode information returned by apc_cache_info()
for APC_CACHE_KEY_FPFILE keys (the keys used when apc.stat is off).
In the current version, apc_cache_info() returns garbage for dev/inode info when dealing with such a
slot (as it is a union with the full path). The patch just sets the dev and inode info to 0 when the
slot's key is not of type APC_CACHE_KEY_FILE. Another option would be to suppress these fields
from the array, but it would introduce a BC break.
Regards
Francois
--- APC-3.0.15_orig/apc_cache.c 2007-10-18 22:39:06.000000000 +0200
+++ APC-3.0.15_nodevinfo/apc_cache.c 2007-10-24 13:48:57.000000000 +0200
@@ -1067,8 +1067,14 @@
if(p->value->type == APC_CACHE_ENTRY_FILE) {
link->data.file.filename = apc_xstrdup(p->value->data.file.filename,
apc_emalloc);
- link->data.file.device = p->key.data.file.device;
- link->data.file.inode = p->key.data.file.inode;
+ if (p->key.type==APC_CACHE_KEY_FILE) {
+ link->data.file.device = p->key.data.file.device;
+ link->data.file.inode = p->key.data.file.inode;
+ }
+ else {
+ link->data.file.device = 0;
+ link->data.file.inode = 0;
+ }
link->type = APC_CACHE_ENTRY_FILE;
} else if(p->value->type == APC_CACHE_ENTRY_USER) {
link->data.user.info = apc_xmemcpy(p->value->data.user.info,
p->value->data.user.info_len, apc_emalloc);