@@ -2407,14 +2407,14 @@ static inline int accel_find_sapi(TSRMLS_D)
2407
2407
return FAILURE ;
2408
2408
}
2409
2409
2410
- static void zend_accel_init_shm (TSRMLS_D )
2410
+ static int zend_accel_init_shm (TSRMLS_D )
2411
2411
{
2412
2412
zend_shared_alloc_lock (TSRMLS_C );
2413
2413
2414
2414
accel_shared_globals = zend_shared_alloc (sizeof (zend_accel_shared_globals ));
2415
2415
if (!accel_shared_globals ) {
2416
2416
zend_accel_error (ACCEL_LOG_FATAL , "Insufficient shared memory!" );
2417
- return ;
2417
+ return FAILURE ;
2418
2418
}
2419
2419
ZSMMG (app_shared_globals ) = accel_shared_globals ;
2420
2420
@@ -2429,7 +2429,8 @@ static void zend_accel_init_shm(TSRMLS_D)
2429
2429
ZCSG (interned_strings ).arBuckets = zend_shared_alloc (ZCSG (interned_strings ).nTableSize * sizeof (Bucket * ));
2430
2430
ZCSG (interned_strings_start ) = zend_shared_alloc ((ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 ));
2431
2431
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 ;
2433
2434
}
2434
2435
ZCSG (interned_strings_end ) = ZCSG (interned_strings_start ) + (ZCG (accel_directives ).interned_strings_buffer * 1024 * 1024 );
2435
2436
ZCSG (interned_strings_top ) = ZCSG (interned_strings_start );
@@ -2468,6 +2469,8 @@ static void zend_accel_init_shm(TSRMLS_D)
2468
2469
ZCSG (restart_in_progress ) = 0 ;
2469
2470
2470
2471
zend_shared_alloc_unlock (TSRMLS_C );
2472
+
2473
+ return SUCCESS ;
2471
2474
}
2472
2475
2473
2476
static void accel_globals_ctor (zend_accel_globals * accel_globals TSRMLS_DC )
@@ -2525,7 +2528,10 @@ static int accel_startup(zend_extension *extension)
2525
2528
/********************************************/
2526
2529
switch (zend_shared_alloc_startup (ZCG (accel_directives ).memory_consumption )) {
2527
2530
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
+ }
2529
2535
break ;
2530
2536
case ALLOC_FAILURE :
2531
2537
accel_startup_ok = 0 ;
0 commit comments