]> git.sur5r.net Git - openldap/commitdiff
ITS#1891 in ber_flush, no-op if towrite == 0
authorHoward Chu <hyc@openldap.org>
Tue, 18 Jun 2002 01:00:27 +0000 (01:00 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 18 Jun 2002 01:00:27 +0000 (01:00 +0000)
libraries/liblber/io.c

index 95dc49b79e32dbf4a0b9c29d367f93a46233afce..6474acd56d4f3481d0d48882a35a522644b70145 100644 (file)
@@ -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 );