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>
This commit is contained in:
parent
7e7728cd66
commit
99709ab033
4 changed files with 12 additions and 23 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue