]> git.sur5r.net Git - openldap/commitdiff
ber_get_next - set errno to 0 before calling ber_int_sb_read(), otherwise
authorHoward Chu <hyc@openldap.org>
Tue, 20 May 2003 04:08:35 +0000 (04:08 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 20 May 2003 04:08:35 +0000 (04:08 +0000)
an EOF will return with the previously set errno value.

libraries/liblber/io.c

index 2f60e27ca85acb2d49ce1d7f9f6f3a34cfee9c95..2aab7d0040e973bab164295695a8a1907ac3b20e 100644 (file)
@@ -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;