X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Falock.c;h=37d467ad127e658ee0ee0021998f4a13cfa22924;hb=e48f72c1b5a7ce571c7ced749aed473d20b32526;hp=b0bb33789fc7801735517184fb13b85e8fd06d66;hpb=3407467ca27cb023bfef79dc46636470c3458d3b;p=openldap
diff --git a/servers/slapd/alock.c b/servers/slapd/alock.c
index b0bb33789f..37d467ad12 100644
--- a/servers/slapd/alock.c
+++ b/servers/slapd/alock.c
@@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 2005-2006 The OpenLDAP Foundation.
+ * Copyright 2005-2007 The OpenLDAP Foundation.
* Portions Copyright 2004-2005 Symas Corporation.
* All rights reserved.
*
@@ -21,7 +21,7 @@
#include "portable.h"
-#if SLAPD_BDB || SLAPD_HDB || SLAPD_LDBM
+#if SLAPD_BDB || SLAPD_HDB
#include "alock.h"
@@ -32,7 +32,9 @@
#include
#include
#include
+#if HAVE_SYS_FILE_H
#include
+#endif
#include
#ifdef _WIN32
@@ -229,7 +231,7 @@ alock_read_slot ( alock_info_t * info,
}
if (alock_read_iattr (slotbuf) != ALOCK_MAGIC) {
- return 1;
+ return -1;
}
slot_data->al_lock = alock_read_iattr (slotbuf+8);
slot_data->al_stamp = alock_read_iattr (slotbuf+16);
@@ -262,7 +264,8 @@ alock_write_slot ( alock_info_t * info,
alock_write_iattr (slotbuf+16, slot_data->al_stamp);
alock_write_iattr (slotbuf+24, slot_data->al_pid);
- strncpy ((char *)slotbuf+32, slot_data->al_appname, ALOCK_MAX_APPNAME-1);
+ if (slot_data->al_appname)
+ strncpy ((char *)slotbuf+32, slot_data->al_appname, ALOCK_MAX_APPNAME-1);
slotbuf[ALOCK_SLOT_SIZE-1] = '\0';
res = lseek (info->al_fd,