2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

isc_mutex_init and isc_condition_init failures are now fatal

This commit is contained in:
Witold Kręcicki
2018-11-14 08:42:20 +00:00
parent ac4f8a51cc
commit 0bed9bfc28
2 changed files with 7 additions and 9 deletions

View File

@@ -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) \

View File

@@ -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);
}