From 5e3a7005ee30113191974e44e4903d054ce48594 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 24 Sep 1996 20:27:52 +0000 Subject: (check_open_hook): Return EROFS if O_WRITE on a readonly device. (trivfs_S_file_check_access): New function. --- storeio/storeio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'storeio') 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) { -- cgit v1.2.3