From: Howard Chu Date: Mon, 5 Sep 2011 10:52:38 +0000 (-0700) Subject: Fix from key_change consolidation X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a4d0cde2d3cdb8e1c402fdb418b372f9e5472911;p=openldap Fix from key_change consolidation --- 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; } } }