summaryrefslogtreecommitdiffstats
path: root/usr.bin/telnet/sys_bsd.c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1997-01-07 19:47:58 +0000
committerpst <pst@FreeBSD.org>1997-01-07 19:47:58 +0000
commit8f7e8a658530e1968aabc0ac0f782fbed303d4bf (patch)
tree2dff9a048bc39e15cd0278ea5f5782688eeb49af /usr.bin/telnet/sys_bsd.c
parent46b285b874270033b54c235b591d75d3042191ab (diff)
downloadFreeBSD-src-8f7e8a658530e1968aabc0ac0f782fbed303d4bf.zip
FreeBSD-src-8f7e8a658530e1968aabc0ac0f782fbed303d4bf.tar.gz
Import a few relatively minor fixes from current Borman telnet.
Add some buffer overrun fixes from OpenBSD and myself. Add skey calculator kludge from OpenBSD. TODO: do a real merge of dab's sources... probably just make telnet and telnetd contrib software. Obtained from: OpenBSD, dab@bsdi.com
Diffstat (limited to 'usr.bin/telnet/sys_bsd.c')
-rw-r--r--usr.bin/telnet/sys_bsd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c
index f08161c..2ffd147 100644
--- a/usr.bin/telnet/sys_bsd.c
+++ b/usr.bin/telnet/sys_bsd.c
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)sys_bsd.c 8.2 (Berkeley) 12/15/93";
#include <signal.h>
#include <errno.h>
#include <arpa/telnet.h>
+#include <unistd.h>
#include "ring.h"
@@ -1150,17 +1151,24 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
if (FD_ISSET(tin, &ibits)) {
FD_CLR(tin, &ibits);
c = TerminalRead(ttyiring.supply, ring_empty_consecutive(&ttyiring));
+ if (c < 0 && errno == EIO)
+ c = 0;
if (c < 0 && errno == EWOULDBLOCK) {
c = 0;
} else {
- /* EOF detection for line mode!!!! */
- if ((c == 0) && MODE_LOCAL_CHARS(globalmode) && isatty(tin)) {
+ if (c < 0) {
+ return -1;
+ }
+ if (c == 0) {
/* must be an EOF... */
+ if (MODE_LOCAL_CHARS(globalmode) && isatty(tin)) {
*ttyiring.supply = termEofChar;
c = 1;
+ } else {
+ clienteof = 1;
+ shutdown(net, 1);
+ return 0;
}
- if (c <= 0) {
- return -1;
}
if (termdata) {
Dump('<', ttyiring.supply, c);
OpenPOWER on IntegriCloud