@@ -2407,14 +2407,14 @@ static inline int accel_find_sapi(TSRMLS_D)
24072407 return FAILURE ;
24082408}
24092409
2410- static void zend_accel_init_shm (TSRMLS_D )
2410+ static int zend_accel_init_shm (TSRMLS_D )
24112411{
24122412 zend_shared_alloc_lock (TSRMLS_C );
24132413
24142414 accel_shared_globals = zend_shared_alloc (sizeof (zend_accel_shared_globals ));
24152415 if (!accel_shared_globals ) {
24162416 zend_accel_error (ACCEL_LOG_FATAL , "Insufficient shared memory!" );
2417- return ;
2417+ return FAILURE ;
24182418 }
24192419 ZSMMG (app_shared_globals ) = accel_shared_globals ;
24202420
@@ -2429,7 +2429,8 @@ static void zend_accel_init_shm(TSRMLS_D)
24292429 ZCSG (interned_strings ).arBuckets = zend_shared_alloc (ZCSG (interned_strings ).nTableSize * sizeof (Bucket * ));
24302430 ZCSG (interned_strings_start ) = zend_shared_alloc ((ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 ));
24312431 if (!ZCSG (interned_strings ).arBuckets || !ZCSG (interned_strings_start )) {
2432- zend_error (E_ERROR , ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings" );
2432+ zend_accel_error (ACCEL_LOG_FATAL , ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings" );
2433+ return FAILURE ;
24332434 }
24342435 ZCSG (interned_strings_end ) = ZCSG (interned_strings_start ) + (ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 );
24352436 ZCSG (interned_strings_top ) = ZCSG (interned_strings_start );
@@ -2468,6 +2469,8 @@ static void zend_accel_init_shm(TSRMLS_D)
24682469 ZCSG (restart_in_progress ) = 0 ;
24692470
24702471 zend_shared_alloc_unlock (TSRMLS_C );
2472+
2473+ return SUCCESS ;
24712474}
24722475
24732476static void accel_globals_ctor (zend_accel_globals * accel_globals TSRMLS_DC )
@@ -2525,7 +2528,10 @@ static int accel_startup(zend_extension *extension)
25252528/********************************************/
25262529 switch (zend_shared_alloc_startup (ZCG (accel_directives ).memory_consumption )) {
25272530 case ALLOC_SUCCESS :
2528- zend_accel_init_shm (TSRMLS_C );
2531+ if (zend_accel_init_shm (TSRMLS_C ) == FAILURE ) {
2532+ accel_startup_ok = 0 ;
2533+ return FAILURE ;
2534+ }
25292535 break ;
25302536 case ALLOC_FAILURE :
25312537 accel_startup_ok = 0 ;
0 commit comments