From: hno <> Date: Sat, 25 Aug 2007 00:05:28 +0000 (+0000) Subject: Make fatal() a controlled exit without dumping core. We have fatal_dump() for that. X-Git-Tag: SQUID_3_0_PRE7~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=776ff02cfcd82e47b94530519aa4201972d6acbe;p=thirdparty%2Fsquid.git Make fatal() a controlled exit without dumping core. We have fatal_dump() for that. --- diff --git a/src/tools.cc b/src/tools.cc index f2f8157a06..9db8c89842 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.277 2007/07/06 22:23:51 wessels Exp $ + * $Id: tools.cc,v 1.278 2007/08/24 18:05:28 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -389,10 +389,12 @@ death(int sig) if (Config.adminEmail) mail_warranty(); - else - puts(dead_msg()); + puts(dead_msg()); } + if (shutting_down) + exit(1); + abort(); } @@ -481,10 +483,7 @@ fatal(const char *message) fatal_common(message); - if (shutting_down) - exit(1); - else - abort(); + exit(1); } /* printf-style interface for fatal */ @@ -527,6 +526,15 @@ fatal_dump(const char *message) { if (message) fatal_common(message); + /* + * Call leave_suid() here to make sure that swap.state files + * are written as the effective user, rather than root. Squid + * may take on root privs during reconfigure. If squid.conf + * contains a "Bungled" line, fatal() will be called when the + * process still has root privs. + */ + leave_suid(); + if (opt_catch_signals) storeDirWriteCleanLogs(0);