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