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-w32-cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2.tar.gz busybox-w32-cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2.tar.bz2 busybox-w32-cdf62770af9e8bf7d5bb2344ddef8acb3216cfe2.zip |
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) | |||
237 | unsigned opt; | 237 | unsigned opt; |
238 | int count = 0; | 238 | int count = 0; |
239 | struct passwd *pw; | 239 | struct passwd *pw; |
240 | char *opt_host = NULL; | 240 | char *opt_host = opt_host; /* for compiler */ |
241 | char *opt_user = NULL; | 241 | char *opt_user = opt_user; /* for compiler */ |
242 | char full_tty[TTYNAME_SIZE]; | 242 | char full_tty[TTYNAME_SIZE]; |
243 | USE_SELINUX(security_context_t user_sid = NULL;) | 243 | USE_SELINUX(security_context_t user_sid = NULL;) |
244 | USE_FEATURE_UTMP(struct utmp utent;) | 244 | USE_FEATURE_UTMP(struct utmp utent;) |
@@ -287,7 +287,7 @@ int login_main(int argc, char **argv) | |||
287 | 287 | ||
288 | read_or_build_utent(&utent, !amroot); | 288 | read_or_build_utent(&utent, !amroot); |
289 | 289 | ||
290 | if (opt_host) { | 290 | if (opt & LOGIN_OPT_h) { |
291 | USE_FEATURE_UTMP( | 291 | USE_FEATURE_UTMP( |
292 | safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host)); | 292 | safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host)); |
293 | ) | 293 | ) |
@@ -450,9 +450,12 @@ int login_main(int argc, char **argv) | |||
450 | xsetenv("LOGIN_UID", utoa(pw->pw_uid)); | 450 | xsetenv("LOGIN_UID", utoa(pw->pw_uid)); |
451 | xsetenv("LOGIN_GID", utoa(pw->pw_gid)); | 451 | xsetenv("LOGIN_GID", utoa(pw->pw_gid)); |
452 | xsetenv("LOGIN_SHELL", pw->pw_shell); | 452 | xsetenv("LOGIN_SHELL", pw->pw_shell); |
453 | xspawn(t_argv); /* NOMMU-friendly */ | 453 | spawn_and_wait(t_argv); /* NOMMU-friendly */ |
454 | /* All variables are unset by setup_environment */ | 454 | unsetenv("LOGIN_TTY" ); |
455 | wait(NULL); | 455 | unsetenv("LOGIN_USER" ); |
456 | unsetenv("LOGIN_UID" ); | ||
457 | unsetenv("LOGIN_GID" ); | ||
458 | unsetenv("LOGIN_SHELL"); | ||
456 | } | 459 | } |
457 | } | 460 | } |
458 | 461 | ||
@@ -460,9 +463,8 @@ int login_main(int argc, char **argv) | |||
460 | tmp = pw->pw_shell; | 463 | tmp = pw->pw_shell; |
461 | if (!tmp || !*tmp) | 464 | if (!tmp || !*tmp) |
462 | tmp = DEFAULT_SHELL; | 465 | tmp = DEFAULT_SHELL; |
463 | /* setup_environment params: shell, loginshell, changeenv, pw */ | 466 | /* setup_environment params: shell, clear_env, change_env, pw */ |
464 | setup_environment(tmp, 1, !(opt & LOGIN_OPT_p), pw); | 467 | setup_environment(tmp, !(opt & LOGIN_OPT_p), 1, pw); |
465 | /* FIXME: login shell = 1 -> 3rd parameter is ignored! */ | ||
466 | 468 | ||
467 | motd(); | 469 | motd(); |
468 | 470 | ||
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) | |||
93 | opt_shell = pw->pw_shell; | 93 | opt_shell = pw->pw_shell; |
94 | 94 | ||
95 | change_identity(pw); | 95 | change_identity(pw); |
96 | /* setup_environment params: shell, loginshell, changeenv, pw */ | 96 | /* setup_environment params: shell, clear_env, change_env, pw */ |
97 | setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_mp), pw); | 97 | setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_mp), pw); |
98 | USE_SELINUX(set_current_security_context(NULL);) | 98 | USE_SELINUX(set_current_security_context(NULL);) |
99 | 99 | ||