aboutsummaryrefslogtreecommitdiff
path: root/networking/telnetd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-21 09:22:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-21 09:22:28 +0000
commit1101d1c98068d7a49942d6e9e11ca2e789a9cdba (patch)
tree8fcf79323f16e9e29ad0e257184ce4714b29c23b /networking/telnetd.c
parent84c8daa11f4c656bb4ba50b6e1c6d3b34c0f1b39 (diff)
downloadbusybox-1101d1c98068d7a49942d6e9e11ca2e789a9cdba.tar.gz
telnet: shrink
telnetd: shrink, and fix issue file printing test: better and shorter usage text function old new delta putiac2 51 50 -1 putiac 24 20 -4 handlenetoutput 95 91 -4 telnet_main 1480 1475 -5 iacflush 37 32 -5 make_new_session 436 421 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-34) Total: -34 bytes
Diffstat (limited to 'networking/telnetd.c')
-rw-r--r--networking/telnetd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 22ecb3ca8..7f748641b 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -229,11 +229,10 @@ make_new_session(
/* open the child's side of the tty. */
/* NB: setsid() disconnects from any previous ctty's. Therefore
* we must open child's side of the tty AFTER setsid! */
- fd = xopen(tty_name, O_RDWR); /* becomes our ctty */
- dup2(fd, 0);
- dup2(fd, 1);
- dup2(fd, 2);
- while (fd > 2) close(fd--);
+ close(0);
+ xopen(tty_name, O_RDWR); /* becomes our ctty */
+ xdup2(0, 1);
+ xdup2(0, 2);
tcsetpgrp(0, getpid()); /* switch this tty's process group to us */
/* The pseudo-terminal allocated to the client is configured to operate in
@@ -252,7 +251,7 @@ make_new_session(
* issue files, and they may block writing to fd 1,
* (parent is supposed to read it, but parent waits
* for vforked child to exec!) */
- print_login_issue(issuefile, NULL);
+ print_login_issue(issuefile, tty_name);
/* Exec shell / login / whatever */
login_argv[0] = loginpath;