diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-08 21:00:36 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-08 21:00:36 +0100 |
commit | 681efe20d327e9e6774b174a617d66bbb9d21f48 (patch) | |
tree | 4331e443ee303c24364b1655651c8584db8b51c1 /miscutils | |
parent | 86cf0364bd58e07646a23a1128e4a9ea79189579 (diff) | |
download | busybox-w32-681efe20d327e9e6774b174a617d66bbb9d21f48.tar.gz busybox-w32-681efe20d327e9e6774b174a617d66bbb9d21f48.tar.bz2 busybox-w32-681efe20d327e9e6774b174a617d66bbb9d21f48.zip |
use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/conspy.c | 4 | ||||
-rw-r--r-- | miscutils/crontab.c | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/miscutils/conspy.c b/miscutils/conspy.c index 1fdb2fb38..9c5405332 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c | |||
@@ -316,10 +316,8 @@ static NOINLINE void start_shell_in_child(const char* tty_name) | |||
316 | int pid = xvfork(); | 316 | int pid = xvfork(); |
317 | if (pid == 0) { | 317 | if (pid == 0) { |
318 | struct termios termchild; | 318 | struct termios termchild; |
319 | char *shell = getenv("SHELL"); | 319 | const char *shell = get_shell_name(); |
320 | 320 | ||
321 | if (!shell) | ||
322 | shell = (char *) DEFAULT_SHELL; | ||
323 | signal(SIGHUP, SIG_IGN); | 321 | signal(SIGHUP, SIG_IGN); |
324 | // set tty as a controlling tty | 322 | // set tty as a controlling tty |
325 | setsid(); | 323 | setsid(); |
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 163e15dce..16d7fdf69 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c | |||
@@ -20,8 +20,9 @@ | |||
20 | static void edit_file(const struct passwd *pas, const char *file) | 20 | static void edit_file(const struct passwd *pas, const char *file) |
21 | { | 21 | { |
22 | const char *ptr; | 22 | const char *ptr; |
23 | int pid = xvfork(); | 23 | pid_t pid; |
24 | 24 | ||
25 | pid = xvfork(); | ||
25 | if (pid) { /* parent */ | 26 | if (pid) { /* parent */ |
26 | wait4pid(pid); | 27 | wait4pid(pid); |
27 | return; | 28 | return; |
@@ -30,7 +31,7 @@ static void edit_file(const struct passwd *pas, const char *file) | |||
30 | /* CHILD - change user and run editor */ | 31 | /* CHILD - change user and run editor */ |
31 | /* initgroups, setgid, setuid */ | 32 | /* initgroups, setgid, setuid */ |
32 | change_identity(pas); | 33 | change_identity(pas); |
33 | setup_environment(DEFAULT_SHELL, | 34 | setup_environment(pas->pw_shell, |
34 | SETUP_ENV_CHANGEENV | SETUP_ENV_TO_TMP, | 35 | SETUP_ENV_CHANGEENV | SETUP_ENV_TO_TMP, |
35 | pas); | 36 | pas); |
36 | ptr = getenv("VISUAL"); | 37 | ptr = getenv("VISUAL"); |
@@ -41,7 +42,7 @@ static void edit_file(const struct passwd *pas, const char *file) | |||
41 | } | 42 | } |
42 | 43 | ||
43 | BB_EXECLP(ptr, ptr, file, NULL); | 44 | BB_EXECLP(ptr, ptr, file, NULL); |
44 | bb_perror_msg_and_die("exec %s", ptr); | 45 | bb_perror_msg_and_die("can't execute '%s'", ptr); |
45 | } | 46 | } |
46 | 47 | ||
47 | static int open_as_user(const struct passwd *pas, const char *file) | 48 | static int open_as_user(const struct passwd *pas, const char *file) |