]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
This change should fix bug #1837: Segfault on configuration error
authorrousskov <>
Thu, 12 Apr 2007 20:51:10 +0000 (20:51 +0000)
committerrousskov <>
Thu, 12 Apr 2007 20:51:10 +0000 (20:51 +0000)
When quitting on a fatal error, such as a configuration error, Squid may need
to write clean state/log files. Squid uses comm_ routines to do so. Thus, we
must initialize comm_ before such fatal errors are discovered.

Perhaps a better fix would be to avoid writing clean state/log files until
the old ones become dirty?

src/main.cc

index 89e880095595fb9cf3e4bc53ea822bd05b37b45c..1e85fc9d97565a4ba1eb0eca67602eb0d297e492 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.441 2007/02/05 15:15:03 hno Exp $
+ * $Id: main.cc,v 1.442 2007/04/12 14:51:10 rousskov Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -1184,6 +1184,10 @@ main(int argc, char **argv)
 
         Mem::Init();
 
+        setMaxFD();
+
+        comm_init(); /* initialize early to handle fatal() errors */
+
         storeFsInit();         /* required for config parsing */
 
         /* May not be needed for parsing, have not audited for such */
@@ -1207,7 +1211,6 @@ main(int argc, char **argv)
 
 #if TEST_ACCESS
 
-    comm_init();
 
     comm_select_init();
 
@@ -1255,10 +1258,6 @@ main(int argc, char **argv)
     if (!opt_no_daemon)
         watch_child(argv);
 
-    setMaxFD();
-
-    /* init comm module */
-    comm_init();
 
     comm_select_init();