saner error recursion handling

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1928 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-05-11 04:14:39 +00:00
parent 0c0846d1c7
commit 1fd428eed3
+14 -3
View File
@@ -40,9 +40,20 @@ void quit() // normal exit
void fatal(const char *s, ...) // failure exit
{
s_sprintfdlv(msg,s,s);
s_sprintfd(msgerr)("%s (%s)\n", msg, SDL_GetError());
cleanup(msgerr);
static int errors = 0;
errors++;
if(errors <= 2)
{
s_sprintfdlv(msg,s,s);
if(errors <= 1)
{
s_sprintfdlv(msg,s,s);
s_sprintfd(msgerr)("%s (%s)\n", msg, SDL_GetError());
cleanup(msgerr);
}
else puts(msg);
}
exit(EXIT_FAILURE);
}