]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make fatal() a controlled exit without dumping core. We have fatal_dump() for that.
authorhno <>
Sat, 25 Aug 2007 00:05:28 +0000 (00:05 +0000)
committerhno <>
Sat, 25 Aug 2007 00:05:28 +0000 (00:05 +0000)
src/tools.cc

index f2f8157a06c9f5d5f8fd2d052d9f45457f958360..9db8c89842abf78afcd9798cce27d9969cc62c79 100644 (file)
@@ -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);