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