From aa4c7489b708eb54856871ecdf2bbde99fde92bc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 1 Feb 2021 18:10:53 +0000 Subject: Duplicate the stdout file handle when used for logging. Failure to do this may result in a crash on shutdown when started in debug mode. --- src/inspircd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ba7e08eff..8cbb83d6f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -524,7 +524,8 @@ InspIRCd::InspIRCd(int argc, char** argv) if (Config->cmdline.forcedebug) { - FileWriter* fw = new FileWriter(stdout, 1); + FILE* newstdout = fdopen(dup(STDOUT_FILENO), "w"); + FileWriter* fw = new FileWriter(newstdout, 1); FileLogStream* fls = new FileLogStream(LOG_RAWIO, fw); Logs->AddLogTypes("*", fls, true); } -- cgit v1.3.1-10-gc9f91