summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--term/ptyio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/term/ptyio.c b/term/ptyio.c
index 697cd289..782a00f1 100644
--- a/term/ptyio.c
+++ b/term/ptyio.c
@@ -220,7 +220,11 @@ pty_io_read (struct trivfs_protid *cred,
mutex_lock (&global_lock);
- /* Validate CRED. XXX */
+ if ((cred->po->openmodes & O_READ) == 0)
+ {
+ mutex_unlock (&global_lock);
+ return EBADF;
+ }
while (!control_byte
&& (!qsize (outputq) || (termflags & USER_OUTPUT_SUSP)))
@@ -282,7 +286,11 @@ pty_io_write (struct trivfs_protid *cred,
mutex_lock (&global_lock);
- /* Validate CRED. XXX */
+ if ((cred->po->openmodes & O_WRITE) == 0)
+ {
+ mutex_unlock (&global_lock);
+ return EBADF;
+ }
if (remote_input_mode)
{
@@ -349,8 +357,6 @@ pty_io_select (struct trivfs_protid *cred,
mutex_lock (&global_lock);
- /* Validate CRED. XXX */
-
while (1)
{
if ((*type & SELECT_READ) && (control_byte || qsize (outputq)))