]> git.sur5r.net Git - openldap/commitdiff
Tweak previous commit
authorHoward Chu <hyc@openldap.org>
Mon, 31 Dec 2001 12:57:17 +0000 (12:57 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 31 Dec 2001 12:57:17 +0000 (12:57 +0000)
libraries/liblber/sockbuf.c

index dc31e8696e04743324c301e31fb474b3da0269b5..68c8af6184f7e9f1004f51599fbc6a10fff9b890 100644 (file)
@@ -821,12 +821,11 @@ sb_debug_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
        ret = LBER_SBIOD_READ_NEXT( sbiod, buf, len );
        if (sbiod->sbiod_sb->sb_debug & LDAP_DEBUG_PACKETS)
        {
+           int err = errno;
            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,
@@ -834,6 +833,7 @@ sb_debug_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
                ber_log_bprint( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug,
                        (const char *)buf, ret );
            }
+           errno = err;
        }
        return ret;
 }
@@ -846,8 +846,8 @@ sb_debug_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
        ret = LBER_SBIOD_WRITE_NEXT( sbiod, buf, len );
        if (sbiod->sbiod_sb->sb_debug & LDAP_DEBUG_PACKETS)
        {
+           int err = errno;
            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,
@@ -860,6 +860,7 @@ sb_debug_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
                ber_log_bprint( LDAP_DEBUG_PACKETS, sbiod->sbiod_sb->sb_debug,
                        (const char *)buf, ret );
            }
+           errno = err;
        }
 
        return ret;