1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00

Move crash handling out of crash handler installation

This commit is contained in:
elsid 2024-01-19 14:02:48 +01:00
parent 7763fe73d8
commit 8348557893
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -415,11 +415,8 @@ static void getExecPath(char** argv)
}
}
int crashCatcherInstallHandlers(int argc, char** argv, const char* logfile)
static int crashCatcherInstallHandlers(char** argv)
{
if (argc == 2 && strcmp(argv[1], crash_switch) == 0)
crash_handler(logfile);
getExecPath(argv);
/* Set an alternate signal stack so SIGSEGVs caused by stack overflows
@ -509,10 +506,11 @@ void crashCatcherInstall(int argc, char** argv, const std::filesystem::path& cra
{
if ((argc == 2 && strcmp(argv[1], crash_switch) == 0) || !is_debugger_present())
{
if (crashCatcherInstallHandlers(argc, argv, crashLogPath.c_str()) == -1)
{
if (argc == 2 && strcmp(argv[1], crash_switch) == 0)
crash_handler(crashLogPath.c_str());
if (crashCatcherInstallHandlers(argv) == -1)
Log(Debug::Warning) << "Installing crash handler failed";
}
else
Log(Debug::Info) << "Crash handler installed";
}