aboutsummaryrefslogtreecommitdiff
path: root/libbb/setup_environment.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-30 23:58:19 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-30 23:58:19 +0000
commitf34cfff2f032ff8e475c97f69ea49a24f94b64f5 (patch)
tree1c30e984df9cb22a76bb467220667ad56c180d51 /libbb/setup_environment.c
parent91f8f82bfb54a5e4a574112a86eb78cbd7b275cf (diff)
downloadbusybox-w32-f34cfff2f032ff8e475c97f69ea49a24f94b64f5.tar.gz
busybox-w32-f34cfff2f032ff8e475c97f69ea49a24f94b64f5.tar.bz2
busybox-w32-f34cfff2f032ff8e475c97f69ea49a24f94b64f5.zip
setup_environment: cd $HOME regardless of clear_env value.
Diffstat (limited to 'libbb/setup_environment.c')
-rw-r--r--libbb/setup_environment.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c
index 04e333fed..78318ce62 100644
--- a/libbb/setup_environment.c
+++ b/libbb/setup_environment.c
@@ -32,16 +32,16 @@
32 32
33void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) 33void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw)
34{ 34{
35 /* Change the current working directory to be the home directory
36 * of the user */
37 if (chdir(pw->pw_dir)) {
38 xchdir("/");
39 bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
40 }
41
35 if (clear_env) { 42 if (clear_env) {
36 const char *term; 43 const char *term;
37 44
38 /* Change the current working directory to be the home directory
39 * of the user */
40 if (chdir(pw->pw_dir)) {
41 xchdir("/");
42 bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
43 }
44
45 /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. 45 /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
46 Unset all other environment variables. */ 46 Unset all other environment variables. */
47 term = getenv("TERM"); 47 term = getenv("TERM");