From b4c5de57ebd57cfa262d08233eb7877644f0b6c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Thu, 25 Mar 1999 08:11:18 -0800
Subject: [PATCH] now calls error() if exit() is called twice..

Rev: src/builtin_functions.c:1.163
---
 src/builtin_functions.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 52d885ea10..a83fa67839 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.162 1999/03/20 22:54:16 grubba Exp $");
+RCSID("$Id: builtin_functions.c,v 1.163 1999/03/25 16:11:18 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -1234,6 +1234,7 @@ void f_throw(INT32 args)
 
 void f_exit(INT32 args)
 {
+  static int in_exit=0;
   CHECK_SECURITY_OR_ERROR(SECURITY_BIT_SECURITY, ("exit: permission denied.\n"));
   if(args < 1)
     SIMPLE_TOO_FEW_ARGS_ERROR("exit", 1);
@@ -1241,6 +1242,9 @@ void f_exit(INT32 args)
   if(sp[-args].type != T_INT)
     SIMPLE_BAD_ARG_ERROR("exit", 1, "int");
 
+  if(in_exit) error("exit already called!\n");
+  in_exit=1;
+
   assign_svalue(&throw_value, sp-args);
   throw_severity=THROW_EXIT;
   pike_throw();
-- 
GitLab