]> git.sur5r.net Git - openldap/commitdiff
libmdb: Check sem_open() against SEM_FAILED.
authorHallvard Furuseth <hallvard@openldap.org>
Wed, 29 Aug 2012 04:42:52 +0000 (06:42 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Wed, 29 Aug 2012 04:42:52 +0000 (06:42 +0200)
libraries/libmdb/mdb.c

index a2d0cd2e0ab0ddbe11439c1974a5b34271682dd5..e3ad1c4642ffbe57742eb7502499c64b203330b6 100644 (file)
@@ -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;
                }