summaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-03-08 21:00:36 +0100
committerDenys Vlasenko2011-03-08 21:00:36 +0100
commit681efe20d327e9e6774b174a617d66bbb9d21f48 (patch)
tree4331e443ee303c24364b1655651c8584db8b51c1 /networking/ifupdown.c
parent86cf0364bd58e07646a23a1128e4a9ea79189579 (diff)
downloadbusybox-681efe20d327e9e6774b174a617d66bbb9d21f48.zip
busybox-681efe20d327e9e6774b174a617d66bbb9d21f48.tar.gz
use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index c7b560b..7706a84 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -106,6 +106,7 @@ enum {
struct globals {
char **my_environ;
const char *startup_PATH;
+ char *shell;
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
#define INIT_G() do { } while (0)
@@ -986,11 +987,10 @@ static int doit(char *str)
fflush_all();
child = vfork();
- switch (child) {
- case -1: /* failure */
+ if (child < 0) /* failure */
return 0;
- case 0: /* child */
- execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, (char *) NULL, G.my_environ);
+ if (child == 0) { /* child */
+ execle(G.shell, G.shell, "-c", str, (char *) NULL, G.my_environ);
_exit(127);
}
safe_waitpid(child, &status, 0);
@@ -1165,6 +1165,7 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
G.startup_PATH = getenv("PATH");
+ G.shell = xstrdup(get_shell_name());
cmds = iface_down;
if (applet_name[2] == 'u') {