From 3e3c7850344a00d15ab541cf6cd833849f8ad5d9 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Wed, 29 Aug 2012 06:42:52 +0200 Subject: [PATCH] libmdb: Check sem_open() against SEM_FAILED. --- libraries/libmdb/mdb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index a2d0cd2..e3ad1c4 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; }