diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 52d885ea10e83aba9e84162f27fb9c0523b6b20b..a83fa67839572b4c09d9cce69e2aed3c8572e94c 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();