From: Kurt Zeilenga Date: Thu, 7 Jun 2001 16:24:46 +0000 (+0000) Subject: Fix up some locking X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1352 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e8ac75d22f0f8ce9aababc36169710e69028f99c;p=openldap Fix up some locking --- diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index faa076ba18..baaa1c7922 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -275,6 +275,8 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize ) err = db_create( &ret, ldbm_Env, 0 ); if ( err != 0 ) { (void)ret->close(ret, 0); + LDBM_UNLOCK; + return NULL; } @@ -283,12 +285,16 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize ) err = ret->open( ret, name, NULL, DB_TYPE, rw, mode); - LDBM_UNLOCK; - if ( err != 0 ) { + int tmp = errno; (void)ret->close(ret, 0); + errno = tmp; + + LDBM_UNLOCK; return NULL; } + + LDBM_UNLOCK; #elif DB_VERSION_MAJOR >= 2 DB_INFO dbinfo; @@ -336,7 +342,7 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize ) LDBM_UNLOCK; #endif - return( ret ); + return ret; } void