diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-17 08:42:43 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-17 08:42:43 +0000 |
commit | cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2 (patch) | |
tree | f3c72eba4318ead484dfb36c6e21d55f443c5f6b /loginutils | |
parent | 107fe7c081c2e0ab96628b431d9d812cdf9c82b2 (diff) | |
download | busybox-cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2.tar.gz |
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
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/login.c | 20 | ||||
-rw-r--r-- | loginutils/su.c | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index bc437bb6b..a3caa0fca 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -237,8 +237,8 @@ int login_main(int argc, char **argv) unsigned opt; int count = 0; struct passwd *pw; - char *opt_host = NULL; - char *opt_user = NULL; + char *opt_host = opt_host; /* for compiler */ + char *opt_user = opt_user; /* for compiler */ char full_tty[TTYNAME_SIZE]; USE_SELINUX(security_context_t user_sid = NULL;) USE_FEATURE_UTMP(struct utmp utent;) @@ -287,7 +287,7 @@ int login_main(int argc, char **argv) read_or_build_utent(&utent, !amroot); - if (opt_host) { + if (opt & LOGIN_OPT_h) { USE_FEATURE_UTMP( safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host)); ) @@ -450,9 +450,12 @@ int login_main(int argc, char **argv) xsetenv("LOGIN_UID", utoa(pw->pw_uid)); xsetenv("LOGIN_GID", utoa(pw->pw_gid)); xsetenv("LOGIN_SHELL", pw->pw_shell); - xspawn(t_argv); /* NOMMU-friendly */ - /* All variables are unset by setup_environment */ - wait(NULL); + spawn_and_wait(t_argv); /* NOMMU-friendly */ + unsetenv("LOGIN_TTY" ); + unsetenv("LOGIN_USER" ); + unsetenv("LOGIN_UID" ); + unsetenv("LOGIN_GID" ); + unsetenv("LOGIN_SHELL"); } } @@ -460,9 +463,8 @@ int login_main(int argc, char **argv) tmp = pw->pw_shell; if (!tmp || !*tmp) tmp = DEFAULT_SHELL; - /* setup_environment params: shell, loginshell, changeenv, pw */ - setup_environment(tmp, 1, !(opt & LOGIN_OPT_p), pw); - /* FIXME: login shell = 1 -> 3rd parameter is ignored! */ + /* setup_environment params: shell, clear_env, change_env, pw */ + setup_environment(tmp, !(opt & LOGIN_OPT_p), 1, pw); motd(); diff --git a/loginutils/su.c b/loginutils/su.c index 8c55170ca..afb9843f8 100644 --- a/loginutils/su.c +++ b/loginutils/su.c @@ -93,7 +93,7 @@ int su_main(int argc, char **argv) opt_shell = pw->pw_shell; change_identity(pw); - /* setup_environment params: shell, loginshell, changeenv, pw */ + /* setup_environment params: shell, clear_env, change_env, pw */ setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_mp), pw); USE_SELINUX(set_current_security_context(NULL);) |