commit 177e4e58055deabae3e69b77fabfc22be28e36bf
parent 8d1a666dcfbb9e9fcf6ce7a875a4ad4f5ea932ce
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 30 Jun 2021 15:01:45 +0200
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.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -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();