aboutsummaryrefslogtreecommitdiff
path: root/networking/telnetd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-02-02 23:43:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-02-02 23:43:57 +0000
commitd814c986929b0f8deba5a733250c3f59d7678277 (patch)
tree6c9e7705722486f2c2f743fd22684cd9669c6c7a /networking/telnetd.c
parent04158e04591efea20f34c8dc83002e19056a5590 (diff)
downloadbusybox-d814c986929b0f8deba5a733250c3f59d7678277.tar.gz
telnetd: do not advertise TELNET_LFLOW, we do not support
it properly.
Diffstat (limited to 'networking/telnetd.c')
-rw-r--r--networking/telnetd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 481c932db..59d609bc8 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -35,8 +35,8 @@
/* Structure that describes a session */
struct tsession {
struct tsession *next;
+ pid_t shell_pid;
int sockfd_read, sockfd_write, ptyfd;
- int shell_pid;
/* two circular buffers */
/*char *buf1, *buf2;*/
@@ -247,7 +247,8 @@ make_new_session(
static const char iacs_to_send[] ALIGN1 = {
IAC, DO, TELOPT_ECHO,
IAC, DO, TELOPT_NAWS,
- IAC, DO, TELOPT_LFLOW,
+ /* This requires telnetd.ctrlSQ.patch (incomplete) */
+ /* IAC, DO, TELOPT_LFLOW, */
IAC, WILL, TELOPT_ECHO,
IAC, WILL, TELOPT_SGA
};
@@ -284,13 +285,13 @@ make_new_session(
/* Child */
/* Careful - we are after vfork! */
- /* make new session and process group */
- setsid();
-
- /* Restore default signal handling */
+ /* Restore default signal handling ASAP */
bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
- /* open the child's side of the tty. */
+ /* Make new session and process group */
+ setsid();
+
+ /* 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! */
close(0);
@@ -360,7 +361,7 @@ free_session(struct tsession *ts)
* doesn't send SIGKILL. When we close ptyfd,
* kernel sends SIGHUP to processes having slave side opened. */
kill(ts->shell_pid, SIGKILL);
- wait4(ts->shell_pid, NULL, 0, NULL);
+ waitpid(ts->shell_pid, NULL, 0);
#endif
close(ts->ptyfd);
close(ts->sockfd_read);