spurious compiler warning of unused var fix
authorPhil Pennock <pdp@exim.org>
Fri, 4 May 2012 02:18:34 +0000 (19:18 -0700)
committerPhil Pennock <pdp@exim.org>
Fri, 4 May 2012 02:18:34 +0000 (19:18 -0700)
(but added check in case wrong about spuriousness)

src/src/spam.c

index 0597084de50bc217e24418204990c230e0738712..63395f2d54cc0521f5ff31954666dd3c0e3c2aa5 100644 (file)
@@ -27,7 +27,7 @@ int spam(uschar **listptr) {
   uschar user_name_buffer[128];
   unsigned long mbox_size;
   FILE *mbox_file;
-  int spamd_sock;
+  int spamd_sock = -1;
   uschar spamd_buffer[32600];
   int i, j, offset, result;
   uschar spamd_version[8];
@@ -220,6 +220,14 @@ int spam(uschar **listptr) {
 
   }
 
+  if (spamd_sock == -1) {
+    log_write(0, LOG_MAIN|LOG_PANIC,
+        "programming fault, spamd_sock unexpectedly unset");
+    (void)fclose(mbox_file);
+    (void)close(spamd_sock);
+    return DEFER;
+  }
+
   /* now we are connected to spamd on spamd_sock */
   (void)string_format(spamd_buffer,
            sizeof(spamd_buffer),