From f1a7ddc2baedf97c457a69fbb5934e4c5e01aa9f Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 4 Feb 1994 22:20:43 +0000 Subject: Formerly io-select.c.~3~ --- libdiskfs/io-select.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/io-select.c b/libdiskfs/io-select.c index 265f8774..4b64781e 100644 --- a/libdiskfs/io-select.c +++ b/libdiskfs/io-select.c @@ -17,6 +17,7 @@ #include "priv.h" #include "io_S.h" +#include /* Implement io_select as described in . */ error_t @@ -29,9 +30,16 @@ diskfs_S_io_select (struct protid *cred, if (!cred) return EOPNOTSUPP; + mutex_lock (&cred->po->np->lock); + if (((type & SELECT_READ) && !(cred->po->openstat & O_READ)) + || ((type & SELECT_WRITE) && !(cred-po->openstat & O_WRITE))) + { + mutex_unlock (&cred->po->np->lock); + return EBADF; + } + mutex_unlock (&cred->po->np->lock); /* Select is always possible */ - /* XXX should check open modes. */ mach_port_deallocate (mach_task_self (), port); - *possible = type; + *possible = type & ~SELECT_URG; return 0; } -- cgit v1.2.3