From b8172cac10eb5943110003826de210ecf0e7e106 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 4 Oct 1996 20:51:05 +0000 Subject: (pty_open_hook): Reinitialize pty variables. (pty_io_select): Return SELECT_READ if the slave isn't open. (pty_io_read): If the slave isn't open, return EOF. --- term/ptyio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'term/ptyio.c') diff --git a/term/ptyio.c b/term/ptyio.c index d032eab3..4cc8916f 100644 --- a/term/ptyio.c +++ b/term/ptyio.c @@ -80,7 +80,13 @@ pty_open_hook (struct trivfs_control *cntl, } ptyopen = 1; + packet_mode = 0; + user_ioctl_mode = 0; + control_byte = 0; + pktnostop = 0; + mutex_unlock (&global_lock); + return 0; } @@ -292,6 +298,7 @@ pty_io_read (struct trivfs_protid *cred, } while (!control_byte + && (termflags & TTY_OPEN) && (!qsize (outputq) || (termflags & USER_OUTPUT_SUSP))) { if (cred->po->openmodes & O_NONBLOCK) @@ -446,7 +453,8 @@ pty_io_select (struct trivfs_protid *cred, mach_port_t reply, while (1) { - if ((*type & SELECT_READ) && (control_byte || qsize (outputq))) + if ((*type & SELECT_READ) + && (control_byte || qsize (outputq) || !(termflags & TTY_OPEN))) avail |= SELECT_READ; if ((*type & SELECT_URG) && control_byte) -- cgit v1.2.3