aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/default_error_retval.c1
-rw-r--r--libbb/error_msg_and_die.c4
-rw-r--r--libbb/execable.c2
-rw-r--r--libbb/fflush_stdout_and_exit.c2
-rw-r--r--libbb/vfork_daemon_rexec.c14
5 files changed, 14 insertions, 9 deletions
diff --git a/libbb/default_error_retval.c b/libbb/default_error_retval.c
index f4e46a4b5..0b19f2163 100644
--- a/libbb/default_error_retval.c
+++ b/libbb/default_error_retval.c
@@ -13,7 +13,6 @@
* that too seems silly.
*/
-#include <stdlib.h>
#include "libbb.h"
int xfunc_error_retval = EXIT_FAILURE;
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c
index 4a9049364..4115046c2 100644
--- a/libbb/error_msg_and_die.c
+++ b/libbb/error_msg_and_die.c
@@ -10,14 +10,14 @@
#include "libbb.h"
int die_sleep;
-#if ENABLE_FEATURE_EXEC_PREFER_APPLETS
+#if ENABLE_FEATURE_PREFER_APPLETS
jmp_buf die_jmp;
#endif
void xfunc_die(void)
{
if (die_sleep) {
- if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && die_sleep < 0) {
+ if (ENABLE_FEATURE_PREFER_APPLETS && die_sleep < 0) {
/* Special case. We arrive here if NOFORK applet
* calls xfunc, which then decides to die.
* We don't die, but jump instead back to caller.
diff --git a/libbb/execable.c b/libbb/execable.c
index ee10c6123..d84364753 100644
--- a/libbb/execable.c
+++ b/libbb/execable.c
@@ -60,7 +60,7 @@ int exists_execable(const char *filename)
return 0;
}
-#if ENABLE_FEATURE_EXEC_PREFER_APPLETS
+#if ENABLE_FEATURE_PREFER_APPLETS
/* just like the real execvp, but try to launch an applet named 'file' first
*/
int bb_execvp(const char *file, char *const argv[])
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index d79827f45..48889dae8 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -18,7 +18,7 @@ void fflush_stdout_and_exit(int retval)
if (fflush(stdout))
xfunc_die();
- if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && die_sleep < 0) {
+ if (ENABLE_FEATURE_PREFER_APPLETS && die_sleep < 0) {
/* We are in NOFORK applet. Do not exit() directly,
* but use xfunc_die() */
xfunc_error_retval = retval;
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index cf88a2b28..214b645c5 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -102,7 +102,7 @@ int wait_pid(int *wstat, int pid)
int spawn_and_wait(char **argv)
{
-#if ENABLE_FEATURE_EXEC_PREFER_APPLETS
+#if ENABLE_FEATURE_PREFER_APPLETS
int rc;
const struct bb_applet *a = find_applet_by_name(argv[0]);
@@ -121,8 +121,13 @@ int spawn_and_wait(char **argv)
{
int old_sleep = die_sleep;
int old_x = xfunc_error_retval;
- die_sleep = -1; /* special flag */
- /* xfunc_die() checks for it */
+ uint32_t old_m = option_mask32;
+
+ xfunc_error_retval = EXIT_FAILURE;
+ /* special flag for xfunc_die(). If xfunc will "die"
+ * in NOFORK applet, xfunc_die() sees negative
+ * die_sleep and longjmp here instead. */
+ die_sleep = -1;
rc = setjmp(die_jmp);
if (!rc) {
@@ -144,6 +149,7 @@ int spawn_and_wait(char **argv)
die_sleep = old_sleep;
xfunc_error_retval = old_x;
+ option_mask32 = old_m;
return rc;
}
#ifndef BB_NOMMU /* MMU only */
@@ -159,7 +165,7 @@ int spawn_and_wait(char **argv)
rc = spawn(argv);
w:
return wait4pid(rc);
-#else /* !FEATURE_EXEC_PREFER_APPLETS */
+#else /* !FEATURE_PREFER_APPLETS */
return wait4pid(spawn(argv));
#endif
}