Ticket #173: eaccelerator-0.9.5.2-filtercheck.patch
| File eaccelerator-0.9.5.2-filtercheck.patch, 2.4 kB (added by norganna, 5 months ago) |
|---|
-
eaccelerator-0.9.5.2/eaccelerator.c
old new 58 58 # include <utime.h> 59 59 #endif 60 60 #include <fcntl.h> 61 #include <fnmatch.h> 61 62 62 63 #ifndef O_BINARY 63 64 # define O_BINARY 0 … … 1033 1034 return 1; 1034 1035 } 1035 1036 1037 ea_debug_log("\t[%d] Checking cachability: %s\n", getpid(), realname); 1038 1036 1039 /* if "realname" matches to any pattern started with "!" then ignore it */ 1037 1040 for (p = EAG(cond_list); p != NULL; p = p->next) { 1038 if (p->not && match(realname, p->str)) { 1041 if (p->not && fnmatch(p->str, realname, FNM_CASEFOLD | FNM_NOESCAPE | FNM_LEADING_DIR) == 0) { 1042 ea_debug_log("\t[%d] Uncachable: %s (matches !%s)\n", getpid(), realname, p->str); 1039 1043 return 0; 1040 1044 } 1041 1045 } … … 1045 1049 for (p = EAG(cond_list); p != NULL; p = p->next) { 1046 1050 if (!p->not) { 1047 1051 ok = 0; 1048 if (match(realname, p->str)) { 1052 if (fnmatch(p->str, realname, FNM_CASEFOLD | FNM_NOESCAPE | FNM_LEADING_DIR) == 0) { 1053 ea_debug_log("\t[%d] Cachable: %s (matches %s)\n", getpid(), realname, p->str); 1049 1054 return 1; 1050 1055 } 1051 1056 } 1052 1057 } 1058 1059 if (ok == 1) 1060 ea_debug_log("\t[%d] Cachable: %s (no inclusions)\n", getpid(), realname); 1061 else 1062 ea_debug_log("\t[%d] Uncachable: %s (fails inclusions)\n", getpid(), realname); 1053 1063 return ok; 1054 1064 } 1055 1065 … … 1245 1255 zend_op_array *t; 1246 1256 struct stat buf; 1247 1257 char realname[MAXPATHLEN]; 1258 char actualpath[MAXPATHLEN]; 1259 char *rpath; 1248 1260 int nreloads; 1249 1261 time_t compile_time; 1250 1262 int stat_result = 0; … … 1269 1281 ea_debug_log("EACCELERATOR: Warning: \"%s\" is cached but it's mtime is in the future.\n", file_handle->filename); 1270 1282 } 1271 1283 1272 ok_to_cache = eaccelerator_ok_to_cache(file_handle->filename TSRMLS_CC); 1284 rpath = realpath(file_handle->filename, NULL); 1285 if (!rpath) { 1286 strncpy(actualpath, file_handle->filename, MAXPATHLEN); 1287 actualpath[MAXPATHLEN-1] = '\0'; 1288 ea_debug_log("[%d] Using supplied path: \"%s\"\n", getpid(), file_handle->filename); 1289 } 1290 else { 1291 strncpy(actualpath, rpath, MAXPATHLEN); 1292 actualpath[MAXPATHLEN-1] = '\0'; 1293 free(rpath); 1294 ea_debug_log("[%d] Using realpath of %s: \"%s\"\n", getpid(), file_handle->filename, actualpath); 1295 } 1296 ok_to_cache = eaccelerator_ok_to_cache(actualpath TSRMLS_CC); 1273 1297 1274 1298 // eAccelerator isn't working, so just compile the file 1275 1299 if (!EAG(enabled) || (eaccelerator_mm_instance == NULL) ||