use user's shell instead of hardwired "/bin/sh" (android needs this)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2011-03-08 21:00:36 +01:00
parent 86cf0364bd
commit 681efe20d3
12 changed files with 38 additions and 28 deletions

View File

@@ -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') {