I was testing the idle option for fetchmail. When the server
disconnected after half an hour, fetchmail went in an infinite loop.
ltrace showed that it was doing:
SSL_peek() = 0
ERR_get_error () = 0
SSL_read() = 0
in an infinite loop. This patch should fix the infinite loop:
============================================================================
diff -Naur fetchmail-5.9.6.orig/socket.c fetchmail-5.9.6/socket.c
--- fetchmail-5.9.6.orig/socket.c Thu Nov 8 23:43:45 2001
+++ fetchmail-5.9.6/socket.c Thu Jan 3 11:33:24 2002
@@ -581,7 +581,7 @@
newline = NULL;
} else if ((newline = memchr(bp, '\n', n)) != NULL)
n = newline - bp + 1;
- if ((n = SSL_read(ssl, bp, n)) == -1) {
+ if ((n = SSL_read(ssl, bp, n)) <= 0) {
return(-1);
}
/* Check for case where our single character turned out to
============================================================================
Sunil Shetye.