From: Amos Jeffries Date: Wed, 13 Jan 2010 04:17:42 +0000 (+1300) Subject: Regression Fix: Make Squid abort on parse failures. X-Git-Tag: SQUID_3_1_0_16~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fa7489fa2a92b4d6b7dd19b568e05d03bda63ce;p=thirdparty%2Fsquid.git Regression Fix: Make Squid abort on parse failures. The addition of multi-file parsing and catching of thrown errors between them caused any errors in sub-files to be non-fatal and allow Squid to run as if everything was normal, even if parts of the config were not being loaded. Squid will now propigate the error exception out and exit with a count of the errors found. --- diff --git a/src/main.cc b/src/main.cc index cc5cff2dc7..a6bd4127ed 100644 --- a/src/main.cc +++ b/src/main.cc @@ -720,7 +720,11 @@ mainReconfigureFinish(void *) if (Config2.onoff.enable_purge) Config2.onoff.enable_purge = 2; - parseConfigFile(ConfigFile); + // parse the config returns a count of errors encountered. + if ( parseConfigFile(ConfigFile) != 0) { + // for now any errors are a fatal condition... + self_destruct(); + } setUmask(Config.umask); Mem::Report(); @@ -1119,13 +1123,16 @@ static int SquidMainSafe(int argc, char **argv); /* When USE_WIN32_SERVICE is defined, the main function is placed in win32.cc */ extern "C" void WINAPI SquidWinSvcMain(int argc, char **argv) +{ + SquidMainSafe(argc, argv); +} #else int main(int argc, char **argv) -#endif { - SquidMainSafe(argc, argv); + return SquidMainSafe(argc, argv); } +#endif static int SquidMainSafe(int argc, char **argv) @@ -1260,8 +1267,7 @@ SquidMain(int argc, char **argv) Mem::Report(); - if (opt_parse_cfg_only) - + if (opt_parse_cfg_only || parse_err > 0) return parse_err; } setUmask(Config.umask);