diff options
Diffstat (limited to 'contrib/bind9/lib/bind/irs/irs_data.c')
-rw-r--r-- | contrib/bind9/lib/bind/irs/irs_data.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/contrib/bind9/lib/bind/irs/irs_data.c b/contrib/bind9/lib/bind/irs/irs_data.c index f8e65ad..7904286 100644 --- a/contrib/bind9/lib/bind/irs/irs_data.c +++ b/contrib/bind9/lib/bind/irs/irs_data.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.2.4.3 2004/11/30 01:15:43 marka Exp $"; +static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.2.4.4 2006/03/10 00:17:21 marka Exp $"; #endif #include "port_before.h" @@ -128,10 +128,15 @@ net_data_init(const char *conf_file) { struct net_data *net_data; if (!once) { - pthread_mutex_lock(&keylock); - if (!once++) - pthread_key_create(&key, net_data_destroy); - pthread_mutex_unlock(&keylock); + if (pthread_mutex_lock(&keylock) != 0) + return (NULL); + if (!once) { + if (pthread_key_create(&key, net_data_destroy) != 0) + return (NULL); + once = 1; + } + if (pthread_mutex_unlock(&keylock) != 0) + return (NULL); } net_data = pthread_getspecific(key); #endif @@ -141,7 +146,10 @@ net_data_init(const char *conf_file) { if (net_data == NULL) return (NULL); #ifdef DO_PTHREADS - pthread_setspecific(key, net_data); + if (pthread_setspecific(key, net_data) != 0) { + net_data_destroy(net_data); + return (NULL); + } #endif } |