mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
isc_mutex_init and isc_condition_init failures are now fatal
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
typedef pthread_cond_t isc_condition_t;
|
||||
|
||||
#define isc_condition_init(cp) \
|
||||
((pthread_cond_init((cp), NULL) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
(RUNTIME_CHECK(pthread_cond_init((cp), NULL) == 0), \
|
||||
ISC_R_SUCCESS)
|
||||
|
||||
#if ISC_MUTEX_PROFILE
|
||||
#define isc_condition_wait(cp, mp) \
|
||||
|
@@ -88,10 +88,10 @@ isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) {
|
||||
int i, err;
|
||||
|
||||
err = pthread_mutex_init(&mp->mutex, NULL);
|
||||
if (err == ENOMEM)
|
||||
return (ISC_R_NOMEMORY);
|
||||
if (err != 0)
|
||||
return (ISC_R_UNEXPECTED);
|
||||
if (err != 0) {
|
||||
strerror_r(err, strbuf, sizeof(strbuf));
|
||||
isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(pthread_mutex_lock(&statslock) == 0);
|
||||
|
||||
@@ -294,9 +294,7 @@ isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) {
|
||||
return (ISC_R_NOMEMORY);
|
||||
if (err != 0) {
|
||||
strerror_r(err, strbuf, sizeof(strbuf));
|
||||
UNEXPECTED_ERROR(file, line, "isc_mutex_init() failed: %s",
|
||||
strbuf);
|
||||
result = ISC_R_UNEXPECTED;
|
||||
isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user