From 634243ef25171d360c1659c209da8d41e657fae2 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 23 May 2008 00:05:45 +1200 Subject: [PATCH] Silence secondary errors on fatal shutdowns. 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 | 5 ++++- src/tools.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/snmp_core.cc b/src/snmp_core.cc index f28d3bdf2b..5a57973f5d 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -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; } } diff --git a/src/tools.cc b/src/tools.cc index a076b09f97..178994eaf2 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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 -- 2.47.3