From a4d0cde2d3cdb8e1c402fdb418b372f9e5472911 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 5 Sep 2011 03:52:38 -0700 Subject: [PATCH] Fix from key_change consolidation --- servers/slapd/back-mdb/idl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-mdb/idl.c b/servers/slapd/back-mdb/idl.c index 4aa7f5843c..35c854ddb7 100644 --- a/servers/slapd/back-mdb/idl.c +++ b/servers/slapd/back-mdb/idl.c @@ -502,7 +502,9 @@ put1: data.mv_data = &id; data.mv_size = sizeof(ID); rc = mdb_cursor_put( cursor, &key[k], &data, MDB_NODUPDATA ); /* Don't worry if it's already there */ - if ( rc != 0 && rc != MDB_KEYEXIST ) { + if ( rc == MDB_KEYEXIST ) + rc = 0; + if ( rc ) { err = "c_put id"; goto fail; } @@ -511,6 +513,7 @@ put1: data.mv_data = &id; fail: Debug( LDAP_DEBUG_ANY, "=> mdb_idl_insert_keys: " "%s failed: %s (%d)\n", err, mdb_strerror(rc), rc ); + break; } } return rc; @@ -600,9 +603,12 @@ mdb_idl_delete_keys( } else { /* initial c_get failed, nothing was done */ fail: - if ( rc != MDB_NOTFOUND ) { + if ( rc == MDB_NOTFOUND ) + rc = 0; + if ( rc ) { Debug( LDAP_DEBUG_ANY, "=> mdb_idl_delete_key: " "%s failed: %s (%d)\n", err, mdb_strerror(rc), rc ); + break; } } } -- 2.39.5