From 0cfa98cb1363eee90d12d762b84b67d98aec2f35 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 24 Oct 2006 10:48:10 +0000 Subject: [PATCH] Alex reports getting coredumps (with high debugging) at process exit because debug_log got closed, but was not set to NULL. Seems like we should not call fclose() before exit so that destructors can write debugging if necessary. The file will be closed anyway when the process truly exits. --- src/main.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main.cc b/src/main.cc index 8c7c6300cb..164d79f42f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.437 2006/09/25 15:04:07 adrian Exp $ + * $Id: main.cc,v 1.438 2006/10/24 04:48:10 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1733,8 +1733,16 @@ SquidShutdown() debug(1, 1) ("Squid Cache (Version %s): Exiting normally.\n", version_string); - if (debug_log) - fclose(debug_log); + /* + * DPW 2006-10-23 + * We used to fclose(debug_log) here if it was set, but then + * we forgot to set it to NULL. That caused some coredumps + * because exit() ends up calling a bunch of destructors and + * such. So rather than forcing the debug_log to close, we'll + * leave it open so that those destructors can write some + * debugging if necessary. The file will be closed anyway when + * the process truly exits. + */ exit(shutdown_status); } -- 2.47.3