Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/telnet PR/18984: John Heasley: telnet spins on dead tty
details: https://anonhg.NetBSD.org/src/rev/aeb1b87fb6a9
branches: trunk
changeset: 544232:aeb1b87fb6a9
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 15 04:48:22 2003 +0000
description:
PR/18984: John Heasley: telnet spins on dead tty
diffstat:
usr.bin/telnet/sys_bsd.c | 13 ++++++++-----
usr.bin/telnet/terminal.c | 13 +++++++++----
2 files changed, 17 insertions(+), 9 deletions(-)
diffs (96 lines):
diff -r 4b88c6803302 -r aeb1b87fb6a9 usr.bin/telnet/sys_bsd.c
--- a/usr.bin/telnet/sys_bsd.c Sat Mar 15 04:45:52 2003 +0000
+++ b/usr.bin/telnet/sys_bsd.c Sat Mar 15 04:48:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_bsd.c,v 1.22 2002/09/23 12:48:04 mycroft Exp $ */
+/* $NetBSD: sys_bsd.c,v 1.23 2003/03/15 04:48:22 christos Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@@ -38,7 +38,7 @@
#if 0
from: static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: sys_bsd.c,v 1.22 2002/09/23 12:48:04 mycroft Exp $");
+__RCSID("$NetBSD: sys_bsd.c,v 1.23 2003/03/15 04:48:22 christos Exp $");
#endif
#endif /* not lint */
@@ -423,7 +423,7 @@
* anything at all, otherwise it returns 1 + the number
* of characters left to write.
#ifndef USE_TERMIO
- * We would really like ask the kernel to wait for the output
+ * We would really like to ask the kernel to wait for the output
* to drain, like we can do with the TCSADRAIN, but we don't have
* that option. The only ioctl that waits for the output to
* drain, TIOCSETP, also flushes the input queue, which is NOT
@@ -443,6 +443,8 @@
tcsetattr(tin, TCSADRAIN, &tmp_tc);
#endif /* USE_TERMIO */
old = ttyflush(SYNCHing|flushout);
+ if (old == -2)
+ return;
} while (old < 0 || old > 1);
}
@@ -980,7 +982,8 @@
* The parameter specifies whether this is a poll operation,
* or a block-until-something-happens operation.
*
- * The return value is 1 if something happened, 0 if not.
+ * The return value is 1 if something happened, 0 if not, < 0 if an
+ * error occured.
*/
int
@@ -1024,7 +1027,7 @@
return 0;
# endif /* defined(TN3270) */
/* I don't like this, does it ever happen? */
- printf("sleep(5) from telnet, after select\r\n");
+ printf("sleep(5) from telnet, after poll\r\n");
sleep(5);
}
return 0;
diff -r 4b88c6803302 -r aeb1b87fb6a9 usr.bin/telnet/terminal.c
--- a/usr.bin/telnet/terminal.c Sat Mar 15 04:45:52 2003 +0000
+++ b/usr.bin/telnet/terminal.c Sat Mar 15 04:48:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: terminal.c,v 1.8 2002/06/14 00:30:57 wiz Exp $ */
+/* $NetBSD: terminal.c,v 1.9 2003/03/15 04:48:22 christos Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
#else
-__RCSID("$NetBSD: terminal.c,v 1.8 2002/06/14 00:30:57 wiz Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.9 2003/03/15 04:48:22 christos Exp $");
#endif
#endif /* not lint */
@@ -116,6 +116,7 @@
* Send as much data as possible to the terminal.
*
* Return value:
+ * -2: Permanent error writing to FD.
* -1: No useful work done, data waiting to go out.
* 0: No data was waiting, so nothing was done.
* 1: All waiting data was written out.
@@ -156,8 +157,12 @@
}
ring_consumed(&ttyoring, n);
}
- if (n < 0)
- return -1;
+ if (n < 0) {
+ if (errno == EAGAIN)
+ return -1;
+ else
+ return -2;
+ }
if (n == n0) {
if (n0)
return -1;
Home |
Main Index |
Thread Index |
Old Index