summaryrefslogtreecommitdiff
path: root/busybox/networking/telnet.c
diff options
context:
space:
mode:
authorRob Landley2005-08-13 00:26:01 +0000
committerRob Landley2005-08-13 00:26:01 +0000
commitfc455b2101edbf97331384831de2989ce9cdb731 (patch)
tree521f09b4ca5cb42280e51c7618930ea4f0e68dfb /busybox/networking/telnet.c
parent365a345e92c25c60c977aa1596e31a1e6b9cea80 (diff)
downloadbusybox-fc455b2101edbf97331384831de2989ce9cdb731.zip
busybox-fc455b2101edbf97331384831de2989ce9cdb731.tar.gz
1.0 backports of:
10861, 10875, 10881, 10888 ash fix 10865 suid thing? (look at this) 10886 telnet bugfix 10866 ftp fix for RFC 959 compliance. 10867 Remove spurious newline from cp -i prompt. 10874 ksyslogd fix 10876 msh fix 10877 httpd fix 10880, 10889, 11005 dhcp fixes
Diffstat (limited to 'busybox/networking/telnet.c')
-rw-r--r--busybox/networking/telnet.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/busybox/networking/telnet.c b/busybox/networking/telnet.c
index 6ad7712..2416005 100644
--- a/busybox/networking/telnet.c
+++ b/busybox/networking/telnet.c
@@ -96,6 +96,7 @@ static struct Globalvars {
byte charmode;
byte telflags;
byte gotsig;
+ byte do_termios;
/* buffer to handle telnet negotiations */
char iacbuf[IACBUFSIZE];
short iaclen; /* could even use byte */
@@ -616,12 +617,12 @@ static void fgotsig(int sig)
static void rawmode(void)
{
- tcsetattr(0, TCSADRAIN, &G.termios_raw);
+ if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_raw);
}
static void cookmode(void)
{
- tcsetattr(0, TCSADRAIN, &G.termios_def);
+ if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_def);
}
extern int telnet_main(int argc, char** argv)
@@ -649,11 +650,12 @@ extern int telnet_main(int argc, char** argv)
memset(&G, 0, sizeof G);
- if (tcgetattr(0, &G.termios_def) < 0)
- exit(1);
+ if (tcgetattr(0, &G.termios_def) >= 0) {
+ G.do_termios = 1;
- G.termios_raw = G.termios_def;
- cfmakeraw(&G.termios_raw);
+ G.termios_raw = G.termios_def;
+ cfmakeraw(&G.termios_raw);
+ }
if (argc < 2)
bb_show_usage();