]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/alock.c
check for ee == NULL
[openldap] / servers / slapd / alock.c
index 83e0fbd37f1f779dd0069f6ac14da19aab333ee0..d469d3b56fcd1dd18ad207f689536b54ba8c3e2c 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2006 The OpenLDAP Foundation.
+ * Copyright 2005-2007 The OpenLDAP Foundation.
  * Portions Copyright 2004-2005 Symas Corporation.
  * All rights reserved.
  *
@@ -32,7 +32,9 @@
 #include <ac/assert.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
+#endif
 #include <fcntl.h>
 
 #ifdef _WIN32
@@ -514,7 +516,7 @@ alock_scan ( alock_info_t * info )
 }
 
 int
-alock_close ( alock_info_t * info )
+alock_close ( alock_info_t * info, int nosave )
 {
        alock_slot_t slot_data;
        int res;
@@ -538,7 +540,9 @@ alock_close ( alock_info_t * info )
                        free (slot_data.al_appname);
                return ALOCK_UNSTABLE;
        }
-       slot_data.al_lock = ALOCK_UNLOCKED | (slot_data.al_lock & ALOCK_NOSAVE);
+       slot_data.al_lock = ALOCK_UNLOCKED;
+       if ( nosave )
+               slot_data.al_lock |= ALOCK_NOSAVE;
        res = alock_write_slot (info, &slot_data);
        if (res == -1) {
                close (info->al_fd);