traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / libbb / setup_environment.c
index 04e333feddda6dd0f8686f5fd7872919a2932505..78318ce62f24da4187f0a29688b5255669188036 100644 (file)
 
 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");