summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-10-14 20:48:25 +0200
committerRichard Braun <rbraun@sceen.net>2013-10-14 20:50:55 +0200
commit1cfdceba98c380ad1cebb3a6b3d1f141d852c691 (patch)
treeba4d7c387653e0b004f1ce995f6696694a6d847e
parentef6f49570c748bed2c086faecec9064b9b04514a (diff)
term: fix read on a closed PTY
* term/ptyio.c (pty_io_read): Return EIO if the terminal has been closed.
-rw-r--r--term/ptyio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/term/ptyio.c b/term/ptyio.c
index 44a215bb..2da7d6c8 100644
--- a/term/ptyio.c
+++ b/term/ptyio.c
@@ -331,6 +331,12 @@ pty_io_read (struct trivfs_protid *cred,
}
}
+ if (!(termflags & TTY_OPEN))
+ {
+ pthread_mutex_unlock (&global_lock);
+ return EIO;
+ }
+
if (control_byte)
{
size = 1;