summaryrefslogtreecommitdiff
path: root/libbb/setup_environment.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2010-02-24 16:10:09 +0100
committerDenys Vlasenko2010-02-26 09:31:40 +0100
commit99709ab03387ca623e3fc1cac69d242ed44da45c (patch)
treede266d18b15ab43efc0c46dd72f9d926db129c13 /libbb/setup_environment.c
parent7e7728cd66482f6898e3896bf05a12f0f8137e79 (diff)
downloadbusybox-99709ab03387ca623e3fc1cac69d242ed44da45c.zip
busybox-99709ab03387ca623e3fc1cac69d242ed44da45c.tar.gz
crontab: use setup_environment
function old new delta setup_environment 184 198 +14 .rodata 131770 131747 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-23) Total: -9 bytes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libbb/setup_environment.c')
-rw-r--r--libbb/setup_environment.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c
index 78318ce..f0802f0 100644
--- a/libbb/setup_environment.c
+++ b/libbb/setup_environment.c
@@ -30,12 +30,12 @@
#include "libbb.h"
-void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw)
+void FAST_FUNC setup_environment(const char *shell, int clear_env, int flags, const struct passwd *pw)
{
/* Change the current working directory to be the home directory
* of the user */
if (chdir(pw->pw_dir)) {
- xchdir("/");
+ xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
}
@@ -55,8 +55,7 @@ void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_en
//xsetenv("LOGNAME", pw->pw_name);
//xsetenv("HOME", pw->pw_dir);
//xsetenv("SHELL", shell);
- }
- else if (change_env) {
+ } else if (flags & SETUP_ENV_CHANGEENV) {
/* Set HOME, SHELL, and if not becoming a super-user,
USER and LOGNAME. */
if (pw->pw_uid) {