diff options
author | Simon Howard | 2006-06-03 16:12:08 +0000 |
---|---|---|
committer | Simon Howard | 2006-06-03 16:12:08 +0000 |
commit | ff67ee37fb68659245683b7d3a0f091a299d66f2 (patch) | |
tree | 76928cbd12184254a3ced94d46c1e5f9880b3f70 /src/i_system.c | |
parent | 267d98c2325b2fbd78df25eff79ae6f048f48cfe (diff) | |
download | chocolate-doom-ff67ee37fb68659245683b7d3a0f091a299d66f2.tar.gz chocolate-doom-ff67ee37fb68659245683b7d3a0f091a299d66f2.tar.bz2 chocolate-doom-ff67ee37fb68659245683b7d3a0f091a299d66f2.zip |
Detect recursive calls to I_Error to prevent an infinite loop.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 556
Diffstat (limited to 'src/i_system.c')
-rw-r--r-- | src/i_system.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/i_system.c b/src/i_system.c index bb5c2424..ef855cd7 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: i_system.c 463 2006-04-06 19:44:06Z fraggle $ +// $Id: i_system.c 556 2006-06-03 16:12:08Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -81,7 +81,7 @@ //----------------------------------------------------------------------------- static const char -rcsid[] = "$Id: i_system.c 463 2006-04-06 19:44:06Z fraggle $"; +rcsid[] = "$Id: i_system.c 556 2006-06-03 16:12:08Z fraggle $"; #include <stdlib.h> @@ -258,10 +258,22 @@ byte* I_AllocLow(int length) // extern boolean demorecording; +static boolean already_quitting = false; + void I_Error (char *error, ...) { va_list argptr; + if (already_quitting) + { + fprintf(stderr, "Warning: recursive call to I_Error detected.\n"); + exit(-1); + } + else + { + already_quitting = true; + } + // Message first. va_start (argptr,error); fprintf (stderr, "Error: "); |