diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-02-04 22:20:43 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-02-04 22:20:43 +0000 |
commit | f1a7ddc2baedf97c457a69fbb5934e4c5e01aa9f (patch) | |
tree | 5d6885dc595e72635d896c719b4130e7365eb467 /libdiskfs | |
parent | 43fc92da2baf9095b8b9dd170afc41a5007cc565 (diff) |
Formerly io-select.c.~3~
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/io-select.c | 12 |
1 files changed, 10 insertions, 2 deletions
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 <fcntl.h> /* Implement io_select as described in <hurd/io.defs>. */ 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; } |