diff options
Diffstat (limited to 'libbb/error_msg_and_die.c')
-rw-r--r-- | libbb/error_msg_and_die.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c index 0e99a03cf..addd818b7 100644 --- a/libbb/error_msg_and_die.c +++ b/libbb/error_msg_and_die.c | |||
@@ -9,33 +9,6 @@ | |||
9 | 9 | ||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | 11 | ||
12 | int die_sleep; | ||
13 | #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH | ||
14 | jmp_buf die_jmp; | ||
15 | #endif | ||
16 | |||
17 | void xfunc_die(void) | ||
18 | { | ||
19 | if (die_sleep) { | ||
20 | if ((ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH) | ||
21 | && die_sleep < 0 | ||
22 | ) { | ||
23 | /* Special case. We arrive here if NOFORK applet | ||
24 | * calls xfunc, which then decides to die. | ||
25 | * We don't die, but jump instead back to caller. | ||
26 | * NOFORK applets still cannot carelessly call xfuncs: | ||
27 | * p = xmalloc(10); | ||
28 | * q = xmalloc(10); // BUG! if this dies, we leak p! | ||
29 | */ | ||
30 | /* -2222 means "zero" (longjmp can't pass 0) | ||
31 | * run_nofork_applet() catches -2222. */ | ||
32 | longjmp(die_jmp, xfunc_error_retval ? xfunc_error_retval : -2222); | ||
33 | } | ||
34 | sleep(die_sleep); | ||
35 | } | ||
36 | exit(xfunc_error_retval); | ||
37 | } | ||
38 | |||
39 | void bb_error_msg_and_die(const char *s, ...) | 12 | void bb_error_msg_and_die(const char *s, ...) |
40 | { | 13 | { |
41 | va_list p; | 14 | va_list p; |