From: Howard Chu Date: Tue, 20 May 2003 04:08:35 +0000 (+0000) Subject: ber_get_next - set errno to 0 before calling ber_int_sb_read(), otherwise X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~103 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3d9fd176782a0cb34ed8e82d71328f63fd2a1130;p=openldap ber_get_next - set errno to 0 before calling ber_int_sb_read(), otherwise an EOF will return with the previously set errno value. --- diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 2f60e27ca8..2aab7d0040 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -515,6 +515,7 @@ ber_get_next( char buf[sizeof(ber->ber_len)-1]; ber_len_t tlen = 0; + errno = 0; sblen=ber_int_sb_read( sb, ber->ber_rwptr, ((char *)&ber->ber_len + LENSIZE*2 - 1)-ber->ber_rwptr); if (sblen<=0) return LBER_DEFAULT; @@ -655,6 +656,7 @@ ber_get_next( to_go = ber->ber_end - ber->ber_rwptr; assert( to_go > 0 ); + errno = 0; res = ber_int_sb_read( sb, ber->ber_rwptr, to_go ); if (res<=0) return LBER_DEFAULT; ber->ber_rwptr+=res;