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