summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hedenfal <martinh@cvs.openbsd.org>2010-11-26 14:44:02 +0000
committerMartin Hedenfal <martinh@cvs.openbsd.org>2010-11-26 14:44:02 +0000
commit289d6ba1b1b9ed2725c3ee8f50b58c4c0fe12282 (patch)
tree30753eab78dae7df47b96dd2069fccc6fd57bc0a
parent929341fc66bba3a83e0a2a3959613d903249ff00 (diff)
Unbreak re-indexing by checking if an index entry already exists.
-rw-r--r--usr.sbin/ldapd/index.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ldapd/index.c b/usr.sbin/ldapd/index.c
index 7de78731327..8d1b0f8d320 100644
--- a/usr.sbin/ldapd/index.c
+++ b/usr.sbin/ldapd/index.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: index.c,v 1.7 2010/06/26 23:19:42 martinh Exp $ */
+/* $OpenBSD: index.c,v 1.8 2010/11/26 14:44:01 martinh Exp $ */
/*
* Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se>
@@ -112,7 +112,7 @@ index_attribute(struct namespace *ns, char *attr, struct btval *dn,
rc = btree_txn_put(NULL, ns->indx_txn, &key, &val,
BT_NOOVERWRITE);
free(t);
- if (rc == BT_FAIL)
+ if (rc == -1 && errno != EEXIST)
return -1;
}
@@ -169,7 +169,7 @@ index_rdn(struct namespace *ns, struct btval *dn)
log_debug("indexing rdn on %.*s", (int)key.size, (char *)key.data);
rc = btree_txn_put(NULL, ns->indx_txn, &key, &val, BT_NOOVERWRITE);
btval_reset(&key);
- if (rc == BT_FAIL)
+ if (rc == -1 && errno != EEXIST)
return -1;
return 0;
}