From: Kurt Zeilenga Date: Thu, 28 Sep 2000 02:42:20 +0000 (+0000) Subject: working modrdn... X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1866 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f106722ebf6de1fb03b62d1a179308ffffe2bec1;p=openldap working modrdn... (need to fix leaks on transaction retries) --- diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index af380ed06b..f7f573eabd 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -17,8 +17,7 @@ bdb_dn2id_add( BackendDB *be, DB_TXN *txn, const char *dn, - ID id -) + ID id ) { int rc; DBT key, data; @@ -212,8 +211,13 @@ bdb_dn2id( /* fetch it */ rc = db->get( db, txn, &key, &data, 0 ); - Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: id=0x%08lx: %s (%d)\n", - *id, db_strerror( rc ), rc ); + if( rc != 0 ) { + Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n", + db_strerror( rc ), rc, 0 ); + } else { + Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: got id=0x%08lx\n", + *id, 0, 0 ); + } ch_free( key.data ); return rc; diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 39e9fd1eb2..085bed9ac9 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -300,16 +300,18 @@ retry: rc = txn_abort( ltid ); new_ndn, 0, 0 ); rc = bdb_dn2id ( be, ltid, new_ndn, &id ); - if( rc != 0 ) { - switch( rc ) { - case DB_LOCK_DEADLOCK: - case DB_LOCK_NOTGRANTED: - goto retry; - default: - rc = LDAP_OTHER; - text = "internal error"; - } - + switch( rc ) { + case DB_LOCK_DEADLOCK: + case DB_LOCK_NOTGRANTED: + goto retry; + case DB_NOTFOUND: + break; + case 0: + rc = LDAP_ALREADY_EXISTS; + goto return_results; + default: + rc = LDAP_OTHER; + text = "internal error"; goto return_results; }