diff options
author | Miles Bader <miles@gnu.org> | 1996-09-24 20:27:52 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-09-24 20:27:52 +0000 |
commit | 5e3a7005ee30113191974e44e4903d054ce48594 (patch) | |
tree | 176f3ba969180d25c4826502b0e29c344e54c0f4 | |
parent | 5d77a744e519fe48a7a97fe227f5556bba3a2517 (diff) |
(check_open_hook):
Return EROFS if O_WRITE on a readonly device.
(trivfs_S_file_check_access):
New function.
-rw-r--r-- | storeio/storeio.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/storeio/storeio.c b/storeio/storeio.c index fcf39bee..63ad0b3d 100644 --- a/storeio/storeio.c +++ b/storeio/storeio.c @@ -185,6 +185,9 @@ check_open_hook (struct trivfs_control *trivfs_control, { error_t err = 0; + if (!err && readonly && (flags & O_WRITE)) + return EROFS; + mutex_lock (&device_lock); if (device == NULL) /* Try and open the device. */ @@ -202,6 +205,18 @@ check_open_hook (struct trivfs_control *trivfs_control, return err; } +error_t +trivfs_S_file_check_access (struct trivfs_protid *cred, + mach_port_t reply, mach_msg_type_name_t reply_type, + int *allowed) +{ + if (! cred) + return EOPNOTSUPP; + else + return file_check_access (cred->realnode, allowed); + return 0; +} + static error_t open_hook (struct trivfs_peropen *peropen) { |