From b9a4345071382926883871b5fa5983e3b5a11ae7 Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Tue, 21 Mar 2017 18:48:01 +0100 Subject: [PATCH] Backward: Also print stack trace to OpenClonk.log People usually send the log file when something is wrong, so it's a good thing to actually have relevant information about the crash there. --- thirdparty/backward-cpp/backward.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/thirdparty/backward-cpp/backward.hpp b/thirdparty/backward-cpp/backward.hpp index a10f1f04f..839a56213 100644 --- a/thirdparty/backward-cpp/backward.hpp +++ b/thirdparty/backward-cpp/backward.hpp @@ -1955,6 +1955,14 @@ private: printer.address = true; printer.print(st, stderr); + // OpenClonk modification: also print to the log file + if (GetLogFD() > -1) + { + auto f = fdopen(GetLogFD(), "ab"); + printer.print(st, f); + fclose(f); + } + #if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L psiginfo(info, 0); #endif