From: Howard Chu Date: Thu, 21 Sep 2006 09:28:49 +0000 (+0000) Subject: send_search_reference should propagate errors X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~113 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d6d31af4f08548dd6e27629fafc3c6db8b2e3ba9;p=openldap send_search_reference should propagate errors --- diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0cde942a2c..65e83b7232 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -1359,11 +1359,15 @@ slap_send_search_reference( Operation *op, SlapReply *rs ) bytes = send_ldap_ber( op->o_conn, ber ); ber_free_buf( ber ); - ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex ); - ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes ); - ldap_pvt_mp_add_ulong( slap_counters.sc_refs, 1 ); - ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 ); - ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex ); + if ( bytes < 0 ) { + rc = LDAP_UNAVAILABLE; + } else { + ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex ); + ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes ); + ldap_pvt_mp_add_ulong( slap_counters.sc_refs, 1 ); + ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 ); + ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex ); + } #ifdef LDAP_CONNECTIONLESS } #endif