From: Howard Chu Date: Sat, 21 Nov 2009 11:38:42 +0000 (+0000) Subject: in updateCookie, no-op if nothing changed X-Git-Tag: ACLCHECK_0~82 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=75d1e515eea2c36fb7ad2d446c9225ba298e7281;p=openldap in updateCookie, no-op if nothing changed --- diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index eada1d56db..414ab32506 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -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;