]> git.sur5r.net Git - openldap/commitdiff
in updateCookie, no-op if nothing changed
authorHoward Chu <hyc@openldap.org>
Sat, 21 Nov 2009 11:38:42 +0000 (11:38 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 21 Nov 2009 11:38:42 +0000 (11:38 +0000)
servers/slapd/syncrepl.c

index eada1d56db8b9767eaaa6ed368f2c529bba6ef6c..414ab32506e4f41169fbbf79df0c18ea53357073 100644 (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;