From 84641942e5366b2e09367ba4f4376c99f15ecc8e Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 9 Nov 2008 17:21:26 +0000 Subject: apply post-1.12.1 patches, bump version to 1.12.2 --- libbb/setup_environment.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libbb/setup_environment.c') diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index 04e333f..78318ce 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c @@ -32,16 +32,16 @@ void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) { + /* Change the current working directory to be the home directory + * of the user */ + if (chdir(pw->pw_dir)) { + xchdir("/"); + bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); + } + if (clear_env) { const char *term; - /* Change the current working directory to be the home directory - * of the user */ - if (chdir(pw->pw_dir)) { - xchdir("/"); - bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); - } - /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. Unset all other environment variables. */ term = getenv("TERM"); -- cgit v1.1