Fix from key_change consolidation

This commit is contained in:
Howard Chu 2011-09-05 03:52:38 -07:00
parent e44d4cf06a
commit a4d0cde2d3

View File

@ -502,7 +502,9 @@ put1: data.mv_data = &id;
data.mv_size = sizeof(ID); data.mv_size = sizeof(ID);
rc = mdb_cursor_put( cursor, &key[k], &data, MDB_NODUPDATA ); rc = mdb_cursor_put( cursor, &key[k], &data, MDB_NODUPDATA );
/* Don't worry if it's already there */ /* 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"; err = "c_put id";
goto fail; goto fail;
} }
@ -511,6 +513,7 @@ put1: data.mv_data = &id;
fail: fail:
Debug( LDAP_DEBUG_ANY, "=> mdb_idl_insert_keys: " Debug( LDAP_DEBUG_ANY, "=> mdb_idl_insert_keys: "
"%s failed: %s (%d)\n", err, mdb_strerror(rc), rc ); "%s failed: %s (%d)\n", err, mdb_strerror(rc), rc );
break;
} }
} }
return rc; return rc;
@ -600,9 +603,12 @@ mdb_idl_delete_keys(
} else { } else {
/* initial c_get failed, nothing was done */ /* initial c_get failed, nothing was done */
fail: fail:
if ( rc != MDB_NOTFOUND ) { if ( rc == MDB_NOTFOUND )
rc = 0;
if ( rc ) {
Debug( LDAP_DEBUG_ANY, "=> mdb_idl_delete_key: " Debug( LDAP_DEBUG_ANY, "=> mdb_idl_delete_key: "
"%s failed: %s (%d)\n", err, mdb_strerror(rc), rc ); "%s failed: %s (%d)\n", err, mdb_strerror(rc), rc );
break;
} }
} }
} }