]>
Commit | Line | Data |
---|---|---|
7ab4b8d4 | 1 | --- busybox-1.12.1/libbb/setup_environment.c Sun Sep 28 20:04:20 2008 |
2 | +++ busybox-1.12.1-login/libbb/setup_environment.c Fri Oct 31 00:56:51 2008 | |
3 | @@ -32,15 +32,15 @@ | |
4 | ||
5 | void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) | |
6 | { | |
7 | + /* Change the current working directory to be the home directory | |
8 | + * of the user */ | |
9 | + if (chdir(pw->pw_dir)) { | |
10 | + xchdir("/"); | |
11 | + bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); | |
12 | + } | |
13 | + | |
14 | if (clear_env) { | |
15 | const char *term; | |
16 | - | |
17 | - /* Change the current working directory to be the home directory | |
18 | - * of the user */ | |
19 | - if (chdir(pw->pw_dir)) { | |
20 | - xchdir("/"); | |
21 | - bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); | |
22 | - } | |
23 | ||
24 | /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. | |
25 | Unset all other environment variables. */ |