summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-02-01 18:10:53 +0000
committerSadie Powell <sadie@witchery.services>2021-02-01 18:10:53 +0000
commitaa4c7489b708eb54856871ecdf2bbde99fde92bc (patch)
tree21558052ff2f8c6062707920455ea425974379c7 /src
parent5b21a60a9d96827d6822c56b2dfdf08dbce5867f (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp3
1 files changed, 2 insertions, 1 deletions
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);
}