From 99709ab03387ca623e3fc1cac69d242ed44da45c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 24 Feb 2010 16:10:09 +0100 Subject: 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 --- libbb/setup_environment.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libbb/setup_environment.c') diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index 78318ce62..f0802f0e5 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) { -- cgit v1.2.3