From 7c091c9326d86c7b144b1af7159206c47695778e Mon Sep 17 00:00:00 2001
From: John Denker <jsd@av8n.com>
Date: Sat, 21 Jul 2012 06:26:42 -0700
Subject: don't return messy exit status codes in non-check mode

---
 tools/greylist.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

(limited to 'tools')

diff --git a/tools/greylist.c b/tools/greylist.c
index c5c891f..d76ba08 100644
--- a/tools/greylist.c
+++ b/tools/greylist.c
@@ -264,19 +264,20 @@ int main(int _argc, char** _argv){
   }
 
   int sts = foo.doit(penalty);
+  if (sts == ex_syserr) return sts;
+  if (!check) return ex_good;
 
-// perform some extra checks.
+// check mode ... perform some extra checks.
 // Probably a better design would be to
 //  a) make more thorough DNS checks, and
 //  b) move all the DNS checking to a separate module
-  if (check){
-    char* hostvar = getenv("TCPREMOTEHOST");
-    if (!hostvar) {
-      cerr << foo.progid
-        << " from " << foo.ipbase
-        << " ... TCPREMOTEHOST not set???" << endl;
-      exeunt(ex_spam);
-    }
+
+  char* hostvar = getenv("TCPREMOTEHOST");
+  if (!hostvar) {
+    cerr << foo.progid
+      << " from " << foo.ipbase
+      << " ... TCPREMOTEHOST not set???" << endl;
+    exeunt(ex_spam);
   }
   exeunt(sts);
 }
-- 
cgit v1.2.3