isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 90a38ea8103504f4bdb816ee9aa0b26349e7e72b
parent 72fd2aafb7bd57089769b1b215daba1998d8ad2a
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Mon,  5 Apr 2010 13:15:57 +0200

assert valid file handles

i've seen error logs of the type
  SSL_write: Bad file descriptor
and i simply can't nail it, so go for some more drastic measures.

Diffstat:
Msrc/drv_imap.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -384,7 +384,10 @@ socket_perror( const char *func, Socket_t *sock, int ret ) static int socket_read( Socket_t *sock, char *buf, int len ) { - int n = + int n; + + assert( sock->fd >= 0 ); + n = #if HAVE_LIBSSL sock->use_ssl ? SSL_read( sock->ssl, buf, len ) : #endif @@ -400,7 +403,10 @@ socket_read( Socket_t *sock, char *buf, int len ) static int socket_write( Socket_t *sock, char *buf, int len ) { - int n = + int n; + + assert( sock->fd >= 0 ); + n = #if HAVE_LIBSSL sock->use_ssl ? SSL_write( sock->ssl, buf, len ) : #endif