]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Silence secondary errors on fatal shutdowns.
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 22 May 2008 06:04:40 +0000 (18:04 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 22 May 2008 06:04:40 +0000 (18:04 +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 bc93140b3a4d125a14238411ff8e929440a31e22..1fa2fc6a23f656d41d878f253cd7069bb5024392 100644 (file)
@@ -414,9 +414,7 @@ snmpConnectionOpen(void)
 
         len = sizeof(struct sockaddr_in);
         memset(&xaddr, '\0', len);
-        x = getsockname(theOutSnmpConnection,
-
-                        (struct sockaddr *) &xaddr, &len);
+        x = getsockname(theOutSnmpConnection, (struct sockaddr *) &xaddr, &len);
 
         if (x < 0)
             debugs(51, 1, "theOutSnmpConnection FD " << theOutSnmpConnection << ": getsockname: " << xstrerror());
@@ -441,7 +439,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
@@ -462,6 +461,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 3c6e191d1f341c4f36d6b649c1c29fd0efd4bf6c..65a6b16eb7590adccbc4c47687ea4a32b58b246f 100644 (file)
@@ -462,6 +462,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