Add checks and local definitions for all T_xxx macros, not just a few
[exim.git] / src / src / spam.c
index 3c70f6d99a0720f057d92f81664fb6c212dd4239..9544ff6463482fa303568998e378ffafe3917a23 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/spam.c,v 1.6 2005/05/10 22:39:20 tom Exp $ */
+/* $Cambridge: exim/src/src/spam.c,v 1.8 2005/06/22 15:44:38 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -221,7 +221,7 @@ int spam(uschar **listptr) {
   pollfd.fd = spamd_sock;
   pollfd.events = POLLOUT;
 #endif
-  fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
+  (void)fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
   do {
     read = fread(spamd_buffer,1,sizeof(spamd_buffer),mbox_file);
     if (read > 0) {
@@ -247,6 +247,14 @@ again:
       }
 #endif
       wrote = send(spamd_sock,spamd_buffer + offset,read - offset,0);
+      if (wrote == -1)
+      {
+          log_write(0, LOG_MAIN|LOG_PANIC,
+            "spam acl condition: %s on spamd socket", strerror(errno));
+        close(spamd_sock);
+        fclose(mbox_file);
+        return DEFER;
+      }
       if (offset + wrote != read) {
         offset += wrote;
         goto again;