Howard Chu writes:
Keep the sock_errset() if returning LBER_DEFAULT and sblen< 0?
No. ber_int_sb_read() will cause errno to already be set if it cannot fulfill the request.
Sorry, I meant sblen >= 0 of course. That can be a read() result which does not set errno.
And maybe the variable used like i in the changed code must be ber_slen_t instead of int
Why?
Same type as sblen, used for the full ber buffer size. Haven't looked closely enough to see if the particular pointer diff can only be a few bytes or not.