[exim-cvs] spurious compiler warning of unused var fix

Página Inicial
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Para: exim-cvs
Assunto: [exim-cvs] spurious compiler warning of unused var fix
Gitweb: http://git.exim.org/exim.git/commitdiff/0f5014860e54132a13e4ecc2f7f1859a9f3a971b
Commit:     0f5014860e54132a13e4ecc2f7f1859a9f3a971b
Parent:     da3ad30dcfbb4770835c2b7e165bb719f76cfc16
Author:     Phil Pennock <pdp@???>
AuthorDate: Thu May 3 19:18:34 2012 -0700
Committer:  Phil Pennock <pdp@???>
CommitDate: Thu May 3 19:18:34 2012 -0700


    spurious compiler warning of unused var fix


    (but added check in case wrong about spuriousness)
---
 src/src/spam.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)


diff --git a/src/src/spam.c b/src/src/spam.c
index 0597084..63395f2 100644
--- a/src/src/spam.c
+++ b/src/src/spam.c
@@ -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),