From cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 17 Mar 2008 08:42:43 +0000 Subject: dos2unix: tiny shrink login,su: fix setup_environment() so that it works as intended (parameter names were a bit misleading) fdisk: shrink help text: shrink function old new delta login_main 1658 1701 +43 setup_environment 206 203 -3 dos_compatible_flag 4 1 -3 dos2unix_main 383 375 -8 get_boot 1724 1702 -22 fdisk_main 2949 2889 -60 packed_usage 24250 23948 -302 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/6 up/down: 43/-398) Total: -355 bytes text data bss dec hex filename 798768 661 7428 806857 c4fc9 busybox_old 798327 658 7428 806413 c4e0d busybox_unstripped --- libbb/setup_environment.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libbb/setup_environment.c') diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index 19a2c6db5..6e3575cf9 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c @@ -30,16 +30,16 @@ #include "libbb.h" -void setup_environment(const char *shell, int loginshell, int changeenv, const struct passwd *pw) +void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) { - if (loginshell) { + if (clear_env) { const char *term; /* Change the current working directory to be the home directory * of the user */ if (chdir(pw->pw_dir)) { xchdir("/"); - fputs("warning: cannot change to home directory\n", stderr); + bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir); } /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. @@ -56,7 +56,7 @@ void setup_environment(const char *shell, int loginshell, int changeenv, const s //xsetenv("HOME", pw->pw_dir); //xsetenv("SHELL", shell); } - else if (changeenv) { + else if (change_env) { /* Set HOME, SHELL, and if not becoming a super-user, USER and LOGNAME. */ if (pw->pw_uid) { -- cgit v1.2.3