From: rousskov <> Date: Thu, 12 Apr 2007 20:51:10 +0000 (+0000) Subject: This change should fix bug #1837: Segfault on configuration error X-Git-Tag: SQUID_3_0_PRE6~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cd1125eaafd685d0978387ae3b897bf14c3d645;p=thirdparty%2Fsquid.git This change should fix bug #1837: Segfault on configuration error 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? --- diff --git a/src/main.cc b/src/main.cc index 89e8800955..1e85fc9d97 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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();