@@ -2411,14 +2411,14 @@ static inline int accel_find_sapi(TSRMLS_D)
24112411 return FAILURE ;
24122412}
24132413
2414- static void zend_accel_init_shm (TSRMLS_D )
2414+ static int zend_accel_init_shm (TSRMLS_D )
24152415{
24162416 zend_shared_alloc_lock (TSRMLS_C );
24172417
24182418 accel_shared_globals = zend_shared_alloc (sizeof (zend_accel_shared_globals ));
24192419 if (!accel_shared_globals ) {
24202420 zend_accel_error (ACCEL_LOG_FATAL , "Insufficient shared memory!" );
2421- return ;
2421+ return FAILURE ;
24222422 }
24232423 ZSMMG (app_shared_globals ) = accel_shared_globals ;
24242424
@@ -2433,7 +2433,8 @@ static void zend_accel_init_shm(TSRMLS_D)
24332433 ZCSG (interned_strings ).arBuckets = zend_shared_alloc (ZCSG (interned_strings ).nTableSize * sizeof (Bucket * ));
24342434 ZCSG (interned_strings_start ) = zend_shared_alloc ((ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 ));
24352435 if (!ZCSG (interned_strings ).arBuckets || !ZCSG (interned_strings_start )) {
2436- zend_error (E_ERROR , ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings" );
2436+ zend_accel_error (ACCEL_LOG_FATAL , ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings" );
2437+ return FAILURE ;
24372438 }
24382439 ZCSG (interned_strings_end ) = ZCSG (interned_strings_start ) + (ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 );
24392440 ZCSG (interned_strings_top ) = ZCSG (interned_strings_start );
@@ -2472,6 +2473,8 @@ static void zend_accel_init_shm(TSRMLS_D)
24722473 ZCSG (restart_in_progress ) = 0 ;
24732474
24742475 zend_shared_alloc_unlock (TSRMLS_C );
2476+
2477+ return SUCCESS ;
24752478}
24762479
24772480static void accel_globals_ctor (zend_accel_globals * accel_globals TSRMLS_DC )
@@ -2529,7 +2532,10 @@ static int accel_startup(zend_extension *extension)
25292532/********************************************/
25302533 switch (zend_shared_alloc_startup (ZCG (accel_directives ).memory_consumption )) {
25312534 case ALLOC_SUCCESS :
2532- zend_accel_init_shm (TSRMLS_C );
2535+ if (zend_accel_init_shm (TSRMLS_C ) == FAILURE ) {
2536+ accel_startup_ok = 0 ;
2537+ return FAILURE ;
2538+ }
25332539 break ;
25342540 case ALLOC_FAILURE :
25352541 accel_startup_ok = 0 ;
0 commit comments