From d11b134709c53baf490809482cc906abe1dd55d2 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 30 Aug 2002 10:11:54 +0000 Subject: [PATCH] Fix large SASL reads. Use EAGAIN instead of EWOULDBLOCK (was right the first time after all. see read(2) and write(2)...) --- libraries/libldap/cyrus.c | 6 +++--- libraries/libldap/request.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 85b248de67..b892accecd 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -257,7 +257,7 @@ sb_sasl_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) continue; #endif if ( ret <= 0 ) - return ret; + return bufptr ? bufptr : ret; p->sec_buf_in.buf_ptr += ret; } @@ -287,7 +287,7 @@ sb_sasl_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) continue; #endif if ( ret <= 0 ) - return ret; + return bufptr ? bufptr : ret; p->sec_buf_in.buf_ptr += ret; } @@ -335,7 +335,7 @@ sb_sasl_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) return ret; /* Still have something left?? */ if ( p->buf_out.buf_ptr != p->buf_out.buf_end ) { - errno = EWOULDBLOCK; + errno = EAGAIN; return 0; } } diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 0ffd592b21..ed80127306 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -146,7 +146,7 @@ ldap_int_flush_request( LDAPConn *lc = lr->lr_conn; if ( ber_flush( lc->lconn_sb, lr->lr_ber, 0 ) != 0 ) { - if ( errno == EWOULDBLOCK ) { + if ( errno == EAGAIN ) { /* need to continue write later */ lr->lr_status = LDAP_REQST_WRITING; ldap_mark_select_write( ld, lc->lconn_sb ); -- 2.39.5