aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-13 12:50:48 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-13 12:50:48 +0100
commit931c55f9e2b41473132683488820c6fb7c47506b (patch)
tree56cbfd7e7b1d85998192e5b61c132b9d4a465b8b /libbb
parentb3eec1651fb02d70716caa355f49320719f74c75 (diff)
downloadbusybox-w32-931c55f9e2b41473132683488820c6fb7c47506b.tar.gz
busybox-w32-931c55f9e2b41473132683488820c6fb7c47506b.tar.bz2
busybox-w32-931c55f9e2b41473132683488820c6fb7c47506b.zip
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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c
index df2983958..37777204e 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
36 36
37 /* Change the current working directory to be the home directory 37 /* Change the current working directory to be the home directory
38 * of the user */ 38 * of the user */
39 if (!(flags & SETUP_ENV_NO_CHDIR)) { 39 if (flags & SETUP_ENV_CHDIR) {
40 if (chdir(pw->pw_dir) != 0) { 40 if (chdir(pw->pw_dir) != 0) {
41 bb_error_msg("can't change directory to '%s'", pw->pw_dir); 41 bb_error_msg("can't change directory to '%s'", pw->pw_dir);
42 xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/"); 42 xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
@@ -59,7 +59,8 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass
59 //xsetenv("LOGNAME", pw->pw_name); 59 //xsetenv("LOGNAME", pw->pw_name);
60 //xsetenv("HOME", pw->pw_dir); 60 //xsetenv("HOME", pw->pw_dir);
61 //xsetenv("SHELL", shell); 61 //xsetenv("SHELL", shell);
62 } else if (flags & SETUP_ENV_CHANGEENV) { 62 } else
63 if (flags & (SETUP_ENV_CHANGEENV|SETUP_ENV_CHANGEENV_LOGNAME)) {
63 /* Set HOME, SHELL, and if not becoming a super-user 64 /* Set HOME, SHELL, and if not becoming a super-user
64 * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */ 65 * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */
65 if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) { 66 if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) {