diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2010-02-24 16:10:09 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-26 09:31:40 +0100 |
commit | 99709ab03387ca623e3fc1cac69d242ed44da45c (patch) | |
tree | de266d18b15ab43efc0c46dd72f9d926db129c13 /libbb | |
parent | 7e7728cd66482f6898e3896bf05a12f0f8137e79 (diff) | |
download | busybox-w32-99709ab03387ca623e3fc1cac69d242ed44da45c.tar.gz busybox-w32-99709ab03387ca623e3fc1cac69d242ed44da45c.tar.bz2 busybox-w32-99709ab03387ca623e3fc1cac69d242ed44da45c.zip |
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')
-rw-r--r-- | libbb/setup_environment.c | 7 |
1 files changed, 3 insertions, 4 deletions
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 @@ | |||
30 | 30 | ||
31 | #include "libbb.h" | 31 | #include "libbb.h" |
32 | 32 | ||
33 | void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) | 33 | void FAST_FUNC setup_environment(const char *shell, int clear_env, int flags, const struct passwd *pw) |
34 | { | 34 | { |
35 | /* Change the current working directory to be the home directory | 35 | /* Change the current working directory to be the home directory |
36 | * of the user */ | 36 | * of the user */ |
37 | if (chdir(pw->pw_dir)) { | 37 | if (chdir(pw->pw_dir)) { |
38 | xchdir("/"); | 38 | xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/"); |
39 | bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); | 39 | bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); |
40 | } | 40 | } |
41 | 41 | ||
@@ -55,8 +55,7 @@ void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_en | |||
55 | //xsetenv("LOGNAME", pw->pw_name); | 55 | //xsetenv("LOGNAME", pw->pw_name); |
56 | //xsetenv("HOME", pw->pw_dir); | 56 | //xsetenv("HOME", pw->pw_dir); |
57 | //xsetenv("SHELL", shell); | 57 | //xsetenv("SHELL", shell); |
58 | } | 58 | } else if (flags & SETUP_ENV_CHANGEENV) { |
59 | else if (change_env) { | ||
60 | /* Set HOME, SHELL, and if not becoming a super-user, | 59 | /* Set HOME, SHELL, and if not becoming a super-user, |
61 | USER and LOGNAME. */ | 60 | USER and LOGNAME. */ |
62 | if (pw->pw_uid) { | 61 | if (pw->pw_uid) { |