summaryrefslogtreecommitdiff
path: root/trans/fakeroot.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-05-06 00:40:14 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-05-06 00:40:14 +0000
commitc6b7c154a4e5e76f7ccba2c75557355ec96f4b06 (patch)
treeedd5c12040bb21ab2a1c82955d601a6f67bda831 /trans/fakeroot.c
parentfbbe2ced9b5cda5bbe109a95ae331e9fa9d8a085 (diff)
2002-05-06 Marcus Brinkmann <marcus@gnu.org>
* fakeroot.c (netfs_attempt_lookup): Really check for EROFS or EISDIR error from O_RDWR lookup (the last change checked for O_RDWR | O_EXEC looks up, which is also necessary). (netfs_attempt_mkfile): Unlock DIR. (netfs_attempt_create_file): Likewise. (netfs_S_io_map): New function.
Diffstat (limited to 'trans/fakeroot.c')
-rw-r--r--trans/fakeroot.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index a1f3fbb7..9dbb55ac 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -342,7 +342,8 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir,
flags = O_RDWR;
file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
}
- if (file == MACH_PORT_NULL && errno == EACCES)
+ if (file == MACH_PORT_NULL && (errno == EACCES
+ || errno == EROFS || errno == EISDIR))
{
flags = O_READ|O_EXEC;
file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
@@ -456,6 +457,7 @@ netfs_attempt_mkfile (struct iouser *user, struct node *dir,
real_from_fake_mode (mode), &newfile);
if (err == 0)
err = new_node (newfile, MACH_PORT_NULL, O_RDWR|O_EXEC, np);
+ mutex_unlock (&dir->lock);
return err;
}
@@ -466,6 +468,7 @@ netfs_attempt_create_file (struct iouser *user, struct node *dir,
file_t newfile = file_name_lookup_under (dir->nn->file, name,
O_CREAT|O_RDWR|O_EXEC,
real_from_fake_mode (mode));
+ mutex_unlock (&dir->lock);
if (newfile == MACH_PORT_NULL)
return errno;
return new_node (newfile, MACH_PORT_NULL, O_RDWR|O_EXEC, np);
@@ -561,6 +564,24 @@ netfs_file_get_storage_info (struct iouser *cred,
offsets, num_offsets,
data, data_len);
}
+
+error_t
+netfs_S_io_map (struct protid *user,
+ mach_port_t *rdobj, mach_msg_type_name_t *rdobjtype,
+ mach_port_t *wrobj, mach_msg_type_name_t *wrobjtype)
+{
+ error_t err;
+
+ if (!user)
+ return EOPNOTSUPP;
+ *rdobjtype = *wrobjtype = MACH_MSG_TYPE_MOVE_SEND;
+
+ mutex_lock (&user->po->np->lock);
+ err = io_map (user->po->np->nn->file, rdobj, wrobj);
+ mutex_unlock (&user->po->np->lock);
+ return err;
+}
+
int
main (int argc, char **argv)