svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Thu Oct 30 23:58:20 UTC 2008


Author: vda
Date: 2008-10-30 16:58:19 -0700 (Thu, 30 Oct 2008)
New Revision: 23867

Log:
setup_environment: cd $HOME regardless of clear_env value.



Modified:
   trunk/busybox/libbb/setup_environment.c


Changeset:
Modified: trunk/busybox/libbb/setup_environment.c
===================================================================
--- trunk/busybox/libbb/setup_environment.c	2008-10-30 23:42:37 UTC (rev 23866)
+++ trunk/busybox/libbb/setup_environment.c	2008-10-30 23:58:19 UTC (rev 23867)
@@ -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");




More information about the busybox-cvs mailing list