From f311d711c30f7845baf3f86a7f3727fa96b1e711 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 22 Jul 1997 21:26:55 +0000 Subject: (trivfs_S_io_read): Return EINVAL instead of EBADF. (trivfs_S_io_map): Return EINVAL if CRED cannot be read or written. --- storeio/io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'storeio/io.c') diff --git a/storeio/io.c b/storeio/io.c index 4586c683..9c5673c0 100644 --- a/storeio/io.c +++ b/storeio/io.c @@ -41,6 +41,8 @@ trivfs_S_io_map (struct trivfs_protid *cred, { if (! cred) return EOPNOTSUPP; + else if (! (cred->po->openmodes & (O_READ|O_WRITE))) + return EINVAL; else { mach_port_t memobj; @@ -86,7 +88,7 @@ trivfs_S_io_read (struct trivfs_protid *cred, if (! cred) return EOPNOTSUPP; else if (!(cred->po->openmodes & O_READ)) - return EBADF; + return EINVAL; else return open_read ((struct open *)cred->po->hook, offs, amount, (void **)data, data_len); -- cgit v1.2.3