From: Howard Chu Date: Sat, 10 Sep 2011 02:53:56 +0000 (-0700) Subject: Fix bogus error codes X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c5beffc94fa23a91738471c6196e7f69664e541c;p=openldap Fix bogus error codes --- diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c index 47b767a864..33d81fe764 100644 --- a/servers/slapd/back-mdb/search.c +++ b/servers/slapd/back-mdb/search.c @@ -316,7 +316,7 @@ mdb_search( Operation *op, SlapReply *rs ) rs->sr_err = mdb_cursor_open( ltid, mdb->mi_id2entry, &mci ); if ( rs->sr_err ) { send_ldap_error( op, rs, LDAP_OTHER, "internal error" ); - goto done; + return rs->sr_err; } if ( op->ors_deref & LDAP_DEREF_FINDING ) { @@ -862,12 +862,14 @@ nochange: rs->sr_err = LDAP_SUCCESS; done: + if( isc.mc ) + mdb_cursor_close( isc.mc ); + if (mci) + mdb_cursor_close( mci ); if ( moi == &opinfo ) { mdb_txn_reset( moi->moi_txn ); LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next ); } - if( isc.mc ) - mdb_cursor_close( isc.mc ); if( rs->sr_v2ref ) { ber_bvarray_free( rs->sr_v2ref ); rs->sr_v2ref = NULL; diff --git a/servers/slapd/back-mdb/tools.c b/servers/slapd/back-mdb/tools.c index 92130ab1a8..f1bd36a016 100644 --- a/servers/slapd/back-mdb/tools.c +++ b/servers/slapd/back-mdb/tools.c @@ -555,9 +555,7 @@ ID mdb_tool_entry_put( rc = mdb_tool_index_add( &op, txn, e ); if( rc != 0 ) { snprintf( text->bv_val, text->bv_len, - "index_entry_add failed: %s (%d)", - rc == LDAP_OTHER ? "Internal error" : - mdb_strerror(rc), rc ); + "index_entry_add failed: err=%d", rc ); Debug( LDAP_DEBUG_ANY, "=> " LDAP_XSTRING(mdb_tool_entry_put) ": %s\n", text->bv_val, 0, 0 ); @@ -569,8 +567,7 @@ ID mdb_tool_entry_put( rc = mdb_id2entry_add( &op, txn, e ); if( rc != 0 ) { snprintf( text->bv_val, text->bv_len, - "id2entry_add failed: %s (%d)", - mdb_strerror(rc), rc ); + "id2entry_add failed: err=%d", rc ); Debug( LDAP_DEBUG_ANY, "=> " LDAP_XSTRING(mdb_tool_entry_put) ": %s\n", text->bv_val, 0, 0 ); @@ -734,8 +731,8 @@ done: mdb_txn_abort( txi ); Debug( LDAP_DEBUG_ANY, "=> " LDAP_XSTRING(mdb_tool_entry_reindex) - ": txn_aborted! %s (%d)\n", - mdb_strerror(rc), rc, 0 ); + ": txn_aborted! err=%d\n", + rc, 0, 0 ); e->e_id = NOID; txi = NULL; } @@ -794,8 +791,7 @@ ID mdb_tool_entry_modify( rc = mdb_id2entry_update( &op, tid, e ); if( rc != 0 ) { snprintf( text->bv_val, text->bv_len, - "id2entry_add failed: %s (%d)", - mdb_strerror(rc), rc ); + "id2entry_update failed: err=%d", rc ); Debug( LDAP_DEBUG_ANY, "=> " LDAP_XSTRING(mdb_tool_entry_modify) ": %s\n", text->bv_val, 0, 0 );