From: Hallvard Furuseth Date: Wed, 29 Aug 2012 04:42:52 +0000 (+0200) Subject: libmdb: Check sem_open() against SEM_FAILED. X-Git-Tag: OPENLDAP_REL_ENG_2_4_33~25^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3e3c7850344a00d15ab541cf6cd833849f8ad5d9;p=openldap libmdb: Check sem_open() against SEM_FAILED. --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index a2d0cd2e0a..e3ad1c4642 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -2918,7 +2918,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) goto fail; } env->me_rmutex = sem_open(env->me_txns->mti_rmname, O_CREAT, mode, 1); - if (!env->me_rmutex) { + if (env->me_rmutex == SEM_FAILED) { rc = ErrCode(); goto fail; } @@ -2929,7 +2929,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) goto fail; } env->me_wmutex = sem_open(env->me_txns->mti_wmname, O_CREAT, mode, 1); - if (!env->me_wmutex) { + if (env->me_wmutex == SEM_FAILED) { rc = ErrCode(); goto fail; } @@ -2980,12 +2980,12 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) #endif #ifdef USE_POSIX_SEM env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0); - if (!env->me_rmutex) { + if (env->me_rmutex == SEM_FAILED) { rc = ErrCode(); goto fail; } env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0); - if (!env->me_wmutex) { + if (env->me_wmutex == SEM_FAILED) { rc = ErrCode(); goto fail; }