diff options
author | Denys Vlasenko | 2022-01-13 12:50:48 +0100 |
---|---|---|
committer | Denys Vlasenko | 2022-01-13 12:50:48 +0100 |
commit | 931c55f9e2b41473132683488820c6fb7c47506b (patch) | |
tree | 56cbfd7e7b1d85998192e5b61c132b9d4a465b8b /libbb | |
parent | b3eec1651fb02d70716caa355f49320719f74c75 (diff) | |
download | busybox-931c55f9e2b41473132683488820c6fb7c47506b.zip busybox-931c55f9e2b41473132683488820c6fb7c47506b.tar.gz |
libbb: invert the meaning of SETUP_ENV_NO_CHDIR -> SETUP_ENV_CHDIR
Double negatives are hard to grok.
function old new delta
login_main 986 988 +2
su_main 474 470 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-4) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/setup_environment.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index df29839..3777720 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c @@ -36,7 +36,7 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass /* Change the current working directory to be the home directory * of the user */ - if (!(flags & SETUP_ENV_NO_CHDIR)) { + if (flags & SETUP_ENV_CHDIR) { if (chdir(pw->pw_dir) != 0) { bb_error_msg("can't change directory to '%s'", pw->pw_dir); xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/"); @@ -59,7 +59,8 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass //xsetenv("LOGNAME", pw->pw_name); //xsetenv("HOME", pw->pw_dir); //xsetenv("SHELL", shell); - } else if (flags & SETUP_ENV_CHANGEENV) { + } else + if (flags & (SETUP_ENV_CHANGEENV|SETUP_ENV_CHANGEENV_LOGNAME)) { /* Set HOME, SHELL, and if not becoming a super-user * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */ if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) { |