libmdb: Check sem_open() against SEM_FAILED.

vmware
Hallvard Furuseth 12 years ago
parent 4bc18a5dd3
commit 3e3c785034
  1. 8
      libraries/libmdb/mdb.c

@ -2918,7 +2918,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
goto fail; goto fail;
} }
env->me_rmutex = sem_open(env->me_txns->mti_rmname, O_CREAT, mode, 1); 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(); rc = ErrCode();
goto fail; goto fail;
} }
@ -2929,7 +2929,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
goto fail; goto fail;
} }
env->me_wmutex = sem_open(env->me_txns->mti_wmname, O_CREAT, mode, 1); 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(); rc = ErrCode();
goto fail; goto fail;
} }
@ -2980,12 +2980,12 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
#endif #endif
#ifdef USE_POSIX_SEM #ifdef USE_POSIX_SEM
env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0); env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0);
if (!env->me_rmutex) { if (env->me_rmutex == SEM_FAILED) {
rc = ErrCode(); rc = ErrCode();
goto fail; goto fail;
} }
env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0); env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0);
if (!env->me_wmutex) { if (env->me_wmutex == SEM_FAILED) {
rc = ErrCode(); rc = ErrCode();
goto fail; goto fail;
} }

Loading…
Cancel
Save