You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/03/04 06:54:55 UTC

svn commit: rev 6990 - incubator/spamassassin/trunk/spamc

Author: jm
Date: Wed Mar  3 21:45:07 2004
New Revision: 6990

Modified:
   incubator/spamassassin/trunk/spamc/utils.c
Log:
bug 2983: a mistimed timeout results in spurious errors in spamc

Modified: incubator/spamassassin/trunk/spamc/utils.c
==============================================================================
--- incubator/spamassassin/trunk/spamc/utils.c	(original)
+++ incubator/spamassassin/trunk/spamc/utils.c	Wed Mar  3 21:45:07 2004
@@ -153,7 +153,13 @@
 	thistime = fd_timeout_read(fd, fdflag, buf + total, len - total);
 
 	if (thistime < 0) {
-	    return -1;
+	    if (total >= min) {
+		/* error, but we read *some*.  return what we've read
+		 * so far and next read (if there is one) will return -1. */
+		return total;
+	    } else {
+		return -1;
+	    }
 	}
 	else if (thistime == 0) {
 	    /* EOF, but we didn't read the minimum.  return what we've read
@@ -175,7 +181,13 @@
 	thistime = ssl_timeout_read(ssl, buf + total, len - total);
 
 	if (thistime < 0) {
-	    return -1;
+	    if (total >= min) {
+		/* error, but we read *some*.  return what we've read
+		 * so far and next read (if there is one) will return -1. */
+		return total;
+	    } else {
+		return -1;
+	    }
 	}
 	else if (thistime == 0) {
 	    /* EOF, but we didn't read the minimum.  return what we've read