Skip to content

Commit 2dc2280

Browse files
committed
Use zend_accel_error_noreturn in more places
Missed the place in accelerator_blacklist that was the actual motivation here...
1 parent cfb272d commit 2dc2280

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

ext/opcache/zend_accelerator_blacklist.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist)
6060

6161
blacklist->entries = (zend_blacklist_entry *) calloc(sizeof(zend_blacklist_entry), blacklist->size);
6262
if (!blacklist->entries) {
63-
zend_accel_error(ACCEL_LOG_FATAL, "Blacklist initialization: no memory\n");
63+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Blacklist initialization: no memory\n");
6464
return;
6565
}
6666
blacklist->regexp_list = NULL;
6767
}
6868

6969
static void blacklist_report_regexp_error(const char *pcre_error, int pcre_error_offset)
7070
{
71-
zend_accel_error(ACCEL_LOG_ERROR, "Blacklist compilation failed (offset: %d), %s\n", pcre_error_offset, pcre_error);
71+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Blacklist compilation failed (offset: %d), %s\n", pcre_error_offset, pcre_error);
7272
}
7373

7474
static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
@@ -163,7 +163,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
163163
if (*c || i == blacklist->pos - 1) {
164164
if (*c) {
165165
if (!backtrack) {
166-
zend_accel_error(ACCEL_LOG_ERROR, "Too long blacklist entry\n");
166+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Too long blacklist entry\n");
167167
}
168168
p = backtrack;
169169
} else {
@@ -173,7 +173,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
173173

174174
it = (zend_regexp_list*)malloc(sizeof(zend_regexp_list));
175175
if (!it) {
176-
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
176+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "malloc() failed\n");
177177
return;
178178
}
179179
it->next = NULL;
@@ -302,7 +302,7 @@ static void zend_accel_blacklist_loadone(zend_blacklist *blacklist, char *filena
302302
blacklist->entries[blacklist->pos].path_length = path_length;
303303
blacklist->entries[blacklist->pos].path = (char *)malloc(path_length + 1);
304304
if (!blacklist->entries[blacklist->pos].path) {
305-
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
305+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "malloc() failed\n");
306306
fclose(fp);
307307
return;
308308
}

ext/opcache/zend_accelerator_hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
5454
/* set up hash pointers table */
5555
accel_hash->hash_table = zend_shared_alloc(sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
5656
if (!accel_hash->hash_table) {
57-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
57+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
5858
return;
5959
}
6060

6161
/* set up hash values table */
6262
accel_hash->hash_entries = zend_shared_alloc(sizeof(zend_accel_hash_entry)*accel_hash->max_num_entries);
6363
if (!accel_hash->hash_entries) {
64-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
64+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
6565
return;
6666
}
6767
memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);

ext/opcache/zend_shared_alloc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
8686
fchmod(lock_file, 0666);
8787

8888
if (lock_file == -1) {
89-
zend_accel_error(ACCEL_LOG_FATAL, "Unable to create lock file: %s (%d)", strerror(errno), errno);
89+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Unable to create lock file: %s (%d)", strerror(errno), errno);
9090
}
9191
val = fcntl(lock_file, F_GETFD, 0);
9292
val |= FD_CLOEXEC;
@@ -98,7 +98,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
9898

9999
static void no_memory_bailout(size_t allocate_size, char *error)
100100
{
101-
zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
101+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
102102
}
103103

104104
static void copy_shared_segments(void *to, void *from, int count, int size)
@@ -231,14 +231,14 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
231231

232232
p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));
233233
if (!p_tmp_shared_globals) {
234-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
234+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
235235
return ALLOC_FAILURE;
236236
}
237237
memset(p_tmp_shared_globals, 0, sizeof(zend_smm_shared_globals));
238238

239239
tmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *));
240240
if (!tmp_shared_segments) {
241-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
241+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
242242
return ALLOC_FAILURE;
243243
}
244244

@@ -252,7 +252,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
252252

253253
ZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count));
254254
if (!ZSMMG(shared_memory_state).positions) {
255-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
255+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
256256
return ALLOC_FAILURE;
257257
}
258258

@@ -263,7 +263,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
263263
ZSMMG(reserved) = (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end;
264264
ZSMMG(reserved_size) = reserved_size;
265265
} else {
266-
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
266+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
267267
return ALLOC_FAILURE;
268268
}
269269
}
@@ -340,7 +340,7 @@ void *zend_shared_alloc(size_t size)
340340

341341
#if 1
342342
if (!ZCG(locked)) {
343-
zend_accel_error(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
343+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
344344
}
345345
#endif
346346
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
@@ -482,7 +482,7 @@ void zend_shared_alloc_lock(void)
482482
if (errno == EINTR) {
483483
continue;
484484
}
485-
zend_accel_error(ACCEL_LOG_ERROR, "Cannot create lock - %s (%d)", strerror(errno), errno);
485+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Cannot create lock - %s (%d)", strerror(errno), errno);
486486
}
487487
break;
488488
}
@@ -508,7 +508,7 @@ void zend_shared_alloc_unlock(void)
508508

509509
#ifndef ZEND_WIN32
510510
if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {
511-
zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
511+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
512512
}
513513
#ifdef ZTS
514514
tsrm_mutex_unlock(zts_lock);
@@ -631,7 +631,7 @@ void zend_accel_shared_protect(int mode)
631631
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
632632
DWORD oldProtect;
633633
if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode, &oldProtect)) {
634-
zend_accel_error(ACCEL_LOG_ERROR, "Failed to protect memory");
634+
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Failed to protect memory");
635635
}
636636
}
637637
#endif

0 commit comments

Comments
 (0)