The safe_ssl_read and safe_ssl_write functions were setting errno and
then returning 0, which is incorrect. They should be returning -1
instead, since proper code only checks errno when -1 is returned from a
system call.
This patch should hopefully fix a bug that was causing SSL users to be
disconnected when a large number of bytes were being transferred from or
to the IRC server.
---
src/ssl.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ssl.c b/src/ssl.c
index dab194c..7f688ce 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -162,11 +162,11 @@ int safe_ssl_read(aClient *acptr, void *buf, int sz)
{
case SSL_ERROR_WANT_READ:
errno = EWOULDBLOCK;
- return 0;
+ return -1;
}
case SSL_ERROR_SSL:
if(errno == EAGAIN)
- return 0;
+ return -1;
default:
return fatal_ssl_error(ssl_err, SAFE_SSL_READ, acptr);
}
@@ -190,11 +190,11 @@ int safe_ssl_write(aClient *acptr, const void *buf, int sz)
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
errno = EWOULDBLOCK;
- return 0;
+ return -1;
}
case SSL_ERROR_SSL:
if(errno == EAGAIN)
- return 0;
+ return -1;
default:
return fatal_ssl_error(ssl_err, SAFE_SSL_WRITE, acptr);
}
--
1.7.1