Re: SA-Exim timeout

Tim Jackson <[email protected]>
Newsgroups gmane.mail.exim.spamassassin
Message-ID <[email protected]>
Hi all,

OK, I think the timeout we've been discussing is a bug in SA-E, with SA-E
getting caught in a loop. Basically, if I'm right, 'ret' is being re-used
and overwritten when we don't want it to be.

Here's a preliminary patch that seems to fix it (warning: not at all
properly tested!).


--- sa-exim-2.1/sa-exim.c.orig	Mon Oct 14 04:27:57 2002
+++ sa-exim-2.1/sa-exim.c	Mon Oct 21 11:58:52 2002
@@ -312,6 +312,7 @@
 {
 #warning you shouldn''t worry about the "might be clobbered by longjmp",
see source
     int ret;
+    int ret_read;
     int pid;
     int writefd[2];
     int readfd[2];
@@ -618,12 +619,12 @@
      * than SA is going to process, but let's send at least one byte more
for
      * spamc to do the size cutoff, not us */
     chunk=(samaxbody+1 / sizeof(buffera));
-    while ((ret=read(fd, buffer, sizeof(buffera))) > 0 && chunk-- > 0)
+    while ((ret_read=read(fd, buffer, sizeof(buffera))) > 0 && chunk-- >
0)
     {
 	ret=write(writefd[1], buffer, ret);
 	CHECKERR(ret,"body write",__LINE__);
     }
-    CHECKERR(ret, "read body", __LINE__ - 4);
+    CHECKERR(ret_read, "read body", __LINE__ - 4);
     close(writefd[1]);
 
     if (SAEximDebug > 5)
@@ -813,6 +814,7 @@
     afterscan=time(NULL);
     scantime=afterscan-beforescan;
 
+    ret=0;
     wait(&ret);
     if (ret)
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.