From: Howard Chu Date: Tue, 18 Jun 2002 01:00:27 +0000 (+0000) Subject: ITS#1891 in ber_flush, no-op if towrite == 0 X-Git-Tag: NO_SLAP_OP_BLOCKS~1417 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5e6c17bb2b65b41e4699a6daff07bb959a091d80;p=openldap ITS#1891 in ber_flush, no-op if towrite == 0 --- diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 95dc49b79e..6474acd56d 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -191,7 +191,7 @@ ber_free( BerElement *ber, int freebuf ) int ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) { - ber_len_t nwritten, towrite; + ber_len_t towrite; ber_slen_t rc; assert( sb != NULL ); @@ -222,16 +222,14 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) #endif } - nwritten = 0; - do { + while ( towrite > 0 ) { rc = ber_int_sb_write( sb, ber->ber_rwptr, towrite ); if (rc<=0) { return -1; } towrite -= rc; - nwritten += rc; ber->ber_rwptr += rc; - } while ( towrite > 0 ); + } if ( freeit ) ber_free( ber, 1 );