diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-09 21:35:07 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-09 21:35:07 +0000 |
commit | 3f3aa2a57dc648ade9083f3b3ad83cce8206b912 (patch) | |
tree | d5c648f583bb2edef25f05c2bed303df3d1a61f6 /libbb/error_msg_and_die.c | |
parent | cd7001f7055c3fc2d6298ab9e3befe91e951c652 (diff) | |
download | busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.tar.gz busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.tar.bz2 busybox-w32-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.zip |
make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical.
touch: make it a NOFORK applet
Diffstat (limited to 'libbb/error_msg_and_die.c')
-rw-r--r-- | libbb/error_msg_and_die.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c index 7c5a4ebe9..39178a3ce 100644 --- a/libbb/error_msg_and_die.c +++ b/libbb/error_msg_and_die.c | |||
@@ -7,18 +7,19 @@ | |||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <errno.h> | ||
12 | #include <string.h> | ||
13 | #include <stdlib.h> | ||
14 | #include "libbb.h" | 10 | #include "libbb.h" |
15 | 11 | ||
16 | int die_sleep; | 12 | int die_sleep; |
13 | jmp_buf die_jmp; | ||
17 | 14 | ||
18 | void sleep_and_die(void) | 15 | void sleep_and_die(void) |
19 | { | 16 | { |
20 | if (die_sleep) | 17 | if (die_sleep) { |
18 | /* Special case: don't die, but jump */ | ||
19 | if (die_sleep < 0) | ||
20 | longjmp(die_jmp, xfunc_error_retval); | ||
21 | sleep(die_sleep); | 21 | sleep(die_sleep); |
22 | } | ||
22 | exit(xfunc_error_retval); | 23 | exit(xfunc_error_retval); |
23 | } | 24 | } |
24 | 25 | ||