fix parent process being killed before child per interrupt/terminate signals

by ignoring those signals
otherwise the terminal will be left in a weird state, aswell as the parent exit stuff wont be properly run
this was "fine" before https://github.com/Indev450/SRB2Kart-Saturn/commit/f4dc161831a988e725e8639b9674984ebdf5f6bb but now needs to be handled like this
This commit is contained in:
alufolie91 committed 2026-05-04 22:59:39 +02:00
1 parent 391bd7bdcf
commit 3b42afa34d
2 files changed
+26 -3

No files matched your search

+12
View File
@@ -1368,6 +1368,18 @@ static void I_Fork(void)
I_RegisterChildSignals();
break;
default:
// ignore those, those are handled by child process
// otherwise parent might exit before it
// and the below stuff wont run and your terminal will be left in an awkward state
#ifdef SIGINT
signal(SIGINT, SIG_IGN);
#endif
#ifdef SIGBREAK
signal(SIGBREAK, SIG_IGN);
#endif
#ifdef SIGTERM
signal(SIGTERM, SIG_IGN);
#endif
if (logstream)
fclose(logstream);/* the child has this */
+14 -3
View File
@@ -1874,9 +1874,7 @@ static void I_RegisterChildSignals(void)
signal(SIGABRT, signal_handler_child);
signal(SIGFPE, signal_handler_child);
}
#endif
#ifdef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
{
char text[128];
@@ -1912,6 +1910,18 @@ static void I_Fork(void)
I_RegisterChildSignals();
break;
default:
// ignore those, those are handled by child process
// otherwise parent might exit before it
// and the below stuff wont run and your terminal will be left in an awkward state
#ifdef SIGINT
signal(SIGINT, SIG_IGN);
#endif
#ifdef SIGBREAK
signal(SIGBREAK, SIG_IGN);
#endif
#ifdef SIGTERM
signal(SIGTERM, SIG_IGN);
#endif
#ifdef LOGMESSAGES
if (logstream)
fclose(logstream);/* the child has this */
@@ -1920,6 +1930,8 @@ static void I_Fork(void)
#ifdef LOGMESSAGES
/* By the way, exit closes files. */
logstream = fopen(logfilename, "at");
#else
logstream = 0;
#endif
if (c == -1)
{
@@ -2331,7 +2343,6 @@ char *I_GetUserName(void)
strncpy(username, p, MAXPLAYERNAME);
}
if (!fastcmp(username, ""))
return username;