]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Silence secondary errors on fatal shutdowns.
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 22 May 2008 12:05:45 +0000 (00:05 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 22 May 2008 12:05:45 +0000 (00:05 +1200)
This patch causes fatal() errors to set the shutdown flag before aborting.
The result of this is that secondary errors not related to the fatal condition
but caused during the shutdown sequence no longer confuse the error traces.

It also cleans up a little broken whitespace formatting in the snmp_core.cc

src/snmp_core.cc
src/tools.cc

index f28d3bdf2b0a1a842c9a63acef0a0e3806b96a08..5a57973f5d9bb4af555f15f8bcb2e133debac30f 100644 (file)
@@ -445,7 +445,8 @@ snmpConnectionShutdown(void)
      * and 'out' sockets might be just one FD.  This prevents this
      * function from executing repeatedly.  When we are really ready to
      * exit or restart, main will comm_close the 'out' descriptor.
-     */ theInSnmpConnection = -1;
+     */
+    theInSnmpConnection = -1;
 
     /*
      * Normally we only write to the outgoing SNMP socket, but we
@@ -466,6 +467,8 @@ snmpConnectionClose(void)
     if (theOutSnmpConnection > -1) {
         debugs(49, 1, "FD " << theOutSnmpConnection << " Closing SNMP socket");
         comm_close(theOutSnmpConnection);
+        /* make sure the SNMP out connection is unset */
+        theOutSnmpConnection = -1;
     }
 }
 
index a076b09f97b104996c5fadf18b7b6d7aa2d996b1..178994eaf24686e46901833af4ba9fb016de42ca 100644 (file)
@@ -461,6 +461,9 @@ fatal_common(const char *message)
 void
 fatal(const char *message)
 {
+    /* suppress secondary errors from the dying */
+    shutting_down = 1;
+
     releaseServerSockets();
     /* check for store_dirs_rebuilding because fatal() is often
      * used in early initialization phases, long before we ever