aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 23:03:30 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-10 23:03:30 +0000
commit80d14beae9ebe64d3be1e6c2771f292977cf6d2c (patch)
treed0dd803ca8b6c70521895fd5ec71ef532861b8e4 /libbb
parent89054964443b5cb14cba673b86306f534810404a (diff)
downloadbusybox-w32-80d14beae9ebe64d3be1e6c2771f292977cf6d2c.tar.gz
busybox-w32-80d14beae9ebe64d3be1e6c2771f292977cf6d2c.tar.bz2
busybox-w32-80d14beae9ebe64d3be1e6c2771f292977cf6d2c.zip
Rename two config options:
FEATURE_SH_STANDALONE_SHELL => FEATURE_SH_STANDALONE FEATURE_EXEC_PREFER_APPLETS => FEATURE_PREFER_APPLETS Make SH_STANDALONE depend on PREFER_APPLETS. getopt.c: more randomconfig-induced fixes
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 @@
13 * that too seems silly. 13 * that too seems silly.
14 */ 14 */
15 15
16#include <stdlib.h>
17#include "libbb.h" 16#include "libbb.h"
18 17
19int xfunc_error_retval = EXIT_FAILURE; 18int 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 @@
10#include "libbb.h" 10#include "libbb.h"
11 11
12int die_sleep; 12int die_sleep;
13#if ENABLE_FEATURE_EXEC_PREFER_APPLETS 13#if ENABLE_FEATURE_PREFER_APPLETS
14jmp_buf die_jmp; 14jmp_buf die_jmp;
15#endif 15#endif
16 16
17void xfunc_die(void) 17void xfunc_die(void)
18{ 18{
19 if (die_sleep) { 19 if (die_sleep) {
20 if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && die_sleep < 0) { 20 if (ENABLE_FEATURE_PREFER_APPLETS && die_sleep < 0) {
21 /* Special case. We arrive here if NOFORK applet 21 /* Special case. We arrive here if NOFORK applet
22 * calls xfunc, which then decides to die. 22 * calls xfunc, which then decides to die.
23 * We don't die, but jump instead back to caller. 23 * 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)
60 return 0; 60 return 0;
61} 61}
62 62
63#if ENABLE_FEATURE_EXEC_PREFER_APPLETS 63#if ENABLE_FEATURE_PREFER_APPLETS
64/* just like the real execvp, but try to launch an applet named 'file' first 64/* just like the real execvp, but try to launch an applet named 'file' first
65 */ 65 */
66int bb_execvp(const char *file, char *const argv[]) 66int 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)
18 if (fflush(stdout)) 18 if (fflush(stdout))
19 xfunc_die(); 19 xfunc_die();
20 20
21 if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && die_sleep < 0) { 21 if (ENABLE_FEATURE_PREFER_APPLETS && die_sleep < 0) {
22 /* We are in NOFORK applet. Do not exit() directly, 22 /* We are in NOFORK applet. Do not exit() directly,
23 * but use xfunc_die() */ 23 * but use xfunc_die() */
24 xfunc_error_retval = retval; 24 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)
102 102
103int spawn_and_wait(char **argv) 103int spawn_and_wait(char **argv)
104{ 104{
105#if ENABLE_FEATURE_EXEC_PREFER_APPLETS 105#if ENABLE_FEATURE_PREFER_APPLETS
106 int rc; 106 int rc;
107 const struct bb_applet *a = find_applet_by_name(argv[0]); 107 const struct bb_applet *a = find_applet_by_name(argv[0]);
108 108
@@ -121,8 +121,13 @@ int spawn_and_wait(char **argv)
121 { 121 {
122 int old_sleep = die_sleep; 122 int old_sleep = die_sleep;
123 int old_x = xfunc_error_retval; 123 int old_x = xfunc_error_retval;
124 die_sleep = -1; /* special flag */ 124 uint32_t old_m = option_mask32;
125 /* xfunc_die() checks for it */ 125
126 xfunc_error_retval = EXIT_FAILURE;
127 /* special flag for xfunc_die(). If xfunc will "die"
128 * in NOFORK applet, xfunc_die() sees negative
129 * die_sleep and longjmp here instead. */
130 die_sleep = -1;
126 131
127 rc = setjmp(die_jmp); 132 rc = setjmp(die_jmp);
128 if (!rc) { 133 if (!rc) {
@@ -144,6 +149,7 @@ int spawn_and_wait(char **argv)
144 149
145 die_sleep = old_sleep; 150 die_sleep = old_sleep;
146 xfunc_error_retval = old_x; 151 xfunc_error_retval = old_x;
152 option_mask32 = old_m;
147 return rc; 153 return rc;
148 } 154 }
149#ifndef BB_NOMMU /* MMU only */ 155#ifndef BB_NOMMU /* MMU only */
@@ -159,7 +165,7 @@ int spawn_and_wait(char **argv)
159 rc = spawn(argv); 165 rc = spawn(argv);
160 w: 166 w:
161 return wait4pid(rc); 167 return wait4pid(rc);
162#else /* !FEATURE_EXEC_PREFER_APPLETS */ 168#else /* !FEATURE_PREFER_APPLETS */
163 return wait4pid(spawn(argv)); 169 return wait4pid(spawn(argv));
164#endif 170#endif
165} 171}