Changeset 134 for eaccelerator/trunk/eaccelerator.c
- Timestamp:
- 11/20/05 18:53:43 (3 years ago)
- Files:
-
- eaccelerator/trunk/eaccelerator.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/eaccelerator.c
r132 r134 111 111 static zend_op_array *(*mm_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); 112 112 113 #if defined(DEBUG) || defined(WITH_EACCELERATOR_EXECUTOR)114 static void (*mm_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC);115 #endif116 117 113 /* external declarations */ 118 114 PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); … … 253 249 } 254 250 251 /* check the cache dir */ 252 static int check_cache_dir(char *cache_dir) { 253 struct stat buf; 254 int uid = 0; 255 int gid = 0; 256 257 if (stat(cache_dir, &buf) == -1) { 258 ea_debug_error("Cache dir does not exist (could not stat %s)\n", cache_dir); 259 return 0; 260 } 261 if (!(buf.st_mode & S_IFDIR)) { 262 ea_debug_error("%s is not a directory!\n", cache_dir); 263 return 0; 264 } 265 #if 0 266 uid = getuid(); 267 gid = getgid(); 268 if (!((buf.st_uid == uid && (buf.st_mode & (S_IRUSR | S_IWUSR))) /* not root, owner and rw */ 269 || (buf.st_gid == gid && (buf.st_mode & (S_IRGRP | S_IWGRP))) /* not root, group and rw */ 270 || (buf.st_mode & (S_IROTH & S_IWOTH)))) { /* other and rw */ 271 ea_debug_error("%s hasn't got the right permissions!\n", cache_dir); 272 return 0; 273 } 274 #endif 275 return 1; 276 } 277 255 278 /* Initialise the shared memory */ 256 279 static int init_mm(TSRMLS_D) { … … 304 327 eaccelerator_mm_instance->last_prune = time(0); 305 328 EACCELERATOR_PROTECT(); 329 330 if (!check_cache_dir(EAG(cache_dir))) { 331 return FAILURE; 332 } 333 306 334 return SUCCESS; 307 335 } … … 1542 1570 EAG(self_time)[EAG(profile_level)] = 0; 1543 1571 EAG(profile_level)++; 1544 #ifdef WITH_EACCELERATOR_EXECUTOR1545 eaccelerator_execute(op_array TSRMLS_CC);1546 #else1547 1572 mm_saved_zend_execute(op_array TSRMLS_CC); 1548 #endif1549 1573 usec = ea_debug_elapsed_time(&tv_start); 1550 1574 EAG(profile_level)--; … … 2000 2024 if (init_mm(TSRMLS_C) == FAILURE) { 2001 2025 zend_error(E_CORE_WARNING,"[%s] Can not create shared memory area", EACCELERATOR_EXTENSION_NAME); 2026 return FAILURE; 2002 2027 } 2003 2028 … … 2010 2035 #else 2011 2036 zend_compile_file = eaccelerator_compile_file; 2012 #ifdef WITH_EACCELERATOR_EXECUTOR2013 mm_saved_zend_execute = zend_execute;2014 zend_execute = eaccelerator_execute;2015 #endif2016 2037 #endif 2017 2038 } … … 2039 2060 } 2040 2061 zend_compile_file = mm_saved_zend_compile_file; 2041 #if defined(DEBUG) || defined(WITH_EACCELERATOR_EXECUTOR)2042 zend_execute = mm_saved_zend_execute;2043 #endif2044 2062 #ifdef WITH_EACCELERATOR_CONTENT_CACHING 2045 2063 eaccelerator_content_cache_shutdown();