From: Howard Chu Date: Mon, 31 Dec 2001 12:50:09 +0000 (+0000) Subject: in sb_debug_read/write save errno before logging a failure. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~392 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d8e70bd5f4357fc54ac3c770cb3ca28a877cc4cf;p=openldap in sb_debug_read/write save errno before logging a failure. ber_log_printf can cause errors of its own and obscure the original. --- diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index 5ce23ac656..dc31e8696e 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -822,10 +822,11 @@ sb_debug_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len ) if (sbiod->sbiod_sb->sb_debug & LDAP_DEBUG_PACKETS) { if ( ret < 0 ) { + int err = errno; ber_log_printf( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug, "%sread: want=%ld error=%s\n", (char *)sbiod->sbiod_pvt, (long)len, STRERROR( errno ) ); - + errno = err; } else { ber_log_printf( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug, "%sread: want=%ld, got=%ld\n", (char *)sbiod->sbiod_pvt, @@ -846,11 +847,12 @@ sb_debug_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len ) if (sbiod->sbiod_sb->sb_debug & LDAP_DEBUG_PACKETS) { if ( ret < 0 ) { + int err = errno; ber_log_printf( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug, "%swrite: want=%ld error=%s\n", (char *)sbiod->sbiod_pvt, (long)len, STRERROR( errno ) ); - + errno = err; } else { ber_log_printf( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug, "%swrite: want=%ld, written=%ld\n",