summaryrefslogtreecommitdiffhomepage
path: root/loginutils/login.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 23:36:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 23:36:47 +0000
commit4e12b1a2a9e68685dff61acaee1e1f6c377d978c (patch)
tree6d2745f77060d05f843eb186c5227246667d33cb /loginutils/login.c
parentb3523b9cd3ba71b82e36466b17aae3d65a53203e (diff)
libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink text data bss dec hex filename 793669 504 7524 801697 c3ba1 busybox_old 793659 504 7492 801655 c3b77 busybox_unstripped
Diffstat (limited to 'loginutils/login.c')
-rw-r--r--loginutils/login.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index a18b4d5d7..af871436a 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -275,7 +275,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
if (!isatty(0) || !isatty(1) || !isatty(2))
return EXIT_FAILURE; /* Must be a terminal */
safe_strncpy(full_tty, "UNKNOWN", sizeof(full_tty));
- tmp = ttyname(0);
+ tmp = xmalloc_ttyname(STDIN_FILENO);
if (tmp) {
safe_strncpy(full_tty, tmp, sizeof(full_tty));
if (strncmp(full_tty, "/dev/", 5) == 0)
@@ -285,12 +285,12 @@ int login_main(int argc UNUSED_PARAM, char **argv)
read_or_build_utent(&utent, run_by_root);
if (opt & LOGIN_OPT_h) {
- USE_FEATURE_UTMP(
+ if (ENABLE_FEATURE_UTMP)
safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host));
- )
fromhost = xasprintf(" on '%s' from '%s'", short_tty, opt_host);
- } else
+ } else {
fromhost = xasprintf(" on '%s'", short_tty);
+ }
/* Was breaking "login <username>" from shell command line: */
/*bb_setpgrp();*/