diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index e8212f97d..9f103d9c9 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -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 */ diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 9d825a4a3..ab0b60be3 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -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;