Fix signal handler setup error reporting
This commit is contained in:
parent
35053adfb2
commit
838850ffc1
|
@ -2167,6 +2167,26 @@ void I_Sleep(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEWSIGNALHANDLER
|
#ifdef NEWSIGNALHANDLER
|
||||||
|
static void newsignalhandler_Warn(const char *pr)
|
||||||
|
{
|
||||||
|
char text[128];
|
||||||
|
|
||||||
|
snprintf(text, sizeof text,
|
||||||
|
"Error while setting up signal reporting: %s: %s",
|
||||||
|
pr,
|
||||||
|
strerror(errno)
|
||||||
|
);
|
||||||
|
|
||||||
|
I_OutputMsg("%s\n", text);
|
||||||
|
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
|
"Startup error",
|
||||||
|
text, NULL);
|
||||||
|
|
||||||
|
I_ShutdownConsole();
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
static void I_Fork(void)
|
static void I_Fork(void)
|
||||||
{
|
{
|
||||||
int child;
|
int child;
|
||||||
|
@ -2178,10 +2198,7 @@ static void I_Fork(void)
|
||||||
switch (child)
|
switch (child)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
I_Error(
|
newsignalhandler_Warn("fork()");
|
||||||
"Error setting up signal reporting: fork(): %s\n",
|
|
||||||
strerror(errno)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
|
@ -2189,10 +2206,7 @@ static void I_Fork(void)
|
||||||
if (wait(&status) == -1)
|
if (wait(&status) == -1)
|
||||||
{
|
{
|
||||||
kill(child, SIGKILL);
|
kill(child, SIGKILL);
|
||||||
I_Error(
|
newsignalhandler_Warn("wait()");
|
||||||
"Error setting up signal reporting: fork(): %s\n",
|
|
||||||
strerror(errno)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2211,7 +2225,7 @@ static void I_Fork(void)
|
||||||
status = WEXITSTATUS (status);
|
status = WEXITSTATUS (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
I_ShutdownSystem();
|
I_ShutdownConsole();
|
||||||
exit(status);
|
exit(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2468,8 +2482,6 @@ void I_ShutdownSystem(void)
|
||||||
{
|
{
|
||||||
INT32 c;
|
INT32 c;
|
||||||
|
|
||||||
I_ShutdownConsole();
|
|
||||||
|
|
||||||
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
||||||
if (quit_funcs[c])
|
if (quit_funcs[c])
|
||||||
(*quit_funcs[c])();
|
(*quit_funcs[c])();
|
||||||
|
|
Loading…
Reference in a new issue