summaryrefslogtreecommitdiff
path: root/term/ptyio.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-12-05 02:24:00 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-12-05 02:24:00 +0000
commit288de794aea9ad381bd57da0286a319aee28f82f (patch)
tree5b7c609a180637805d3730a5fdde9387b6d37af3 /term/ptyio.c
parent0a871a8810374492f0cd7de759e01d419ded04e7 (diff)
(pty_io_read, pty_io_write): Validate CRED.
Diffstat (limited to 'term/ptyio.c')
-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)))