general: prevent die() from getting recursed into

When something that is called from die() calls die() again,
there is nothing we can do any more but give up.

This would have prevented the spiralling as
seen in https://savannah.gnu.org/bugs/?60853.
master
Benno Schulenberg 2021-06-30 15:01:45 +02:00
parent 8d1a666dcf
commit 177e4e5805
1 changed files with 5 additions and 0 deletions

View File

@ -351,6 +351,11 @@ void die(const char *msg, ...)
{
va_list ap;
openfilestruct *firstone = openfile;
static int stabs = 0;
/* When dying for a second time, just give up. */
if (++stabs > 1)
exit(11);
restore_terminal();