e4a049
--- telnetd/telnetd.c	2005-01-19 14:37:25.000000000 +0000
e4a049
+++ telnetd/telnetd.c.new	2005-01-19 14:48:12.000000000 +0000
e4a049
@@ -697,6 +697,7 @@
e4a049
     int on = 1;
e4a049
     char *HE;
e4a049
     const char *IM;
e4a049
+    int pty_read_ok = 0; /* track whether the pty read has worked yet */
e4a049
 
e4a049
     /*
e4a049
      * Initialize the slc mapping table.
e4a049
@@ -1016,12 +1017,13 @@
e4a049
 	     * off the master side before the slave side is
e4a049
 	     * opened, we get EIO.
e4a049
 	     */
e4a049
-	    if (pcc < 0 && (errno == EWOULDBLOCK || errno == EIO)) {
e4a049
+	    if (pcc < 0 && (errno == EWOULDBLOCK || (errno == EIO && pty_read_ok == 0))) {
e4a049
 		pcc = 0;
e4a049
 	    } 
e4a049
 	    else {
e4a049
 		if (pcc <= 0)
e4a049
 		    break;
e4a049
+		pty_read_ok = 1;	/* mark connection up for read */
e4a049
 #ifdef	LINEMODE
e4a049
 				/*
e4a049
 				 * If ioctl from pty, pass it through net