in updateCookie, no-op if nothing changed

This commit is contained in:
Howard Chu 2009-11-21 11:38:42 +00:00
parent 9992d5c43a
commit 75d1e515ee

View File

@ -3025,7 +3025,7 @@ syncrepl_updateCookie(
Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
#endif
int rc, i, j;
int rc, i, j, changed = 0;
ber_len_t len;
slap_callback cb = { NULL };
@ -3067,6 +3067,7 @@ syncrepl_updateCookie(
if ( memcmp( syncCookie->ctxcsn[i].bv_val,
si->si_cookieState->cs_vals[j].bv_val, len ) > 0 ) {
mod.sml_values[j] = syncCookie->ctxcsn[i];
changed = 1;
if ( BER_BVISNULL( &first ) ) {
first = syncCookie->ctxcsn[i];
@ -3089,10 +3090,11 @@ syncrepl_updateCookie(
{
first = syncCookie->ctxcsn[i];
}
changed = 1;
}
}
/* Should never happen, ITS#5065 */
if ( BER_BVISNULL( &first )) {
if ( BER_BVISNULL( &first ) || !changed ) {
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
op->o_tmpfree( mod.sml_values, op->o_tmpmemctx );
return 0;