summaryrefslogtreecommitdiff
path: root/trans/fakeroot.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-05 19:31:46 +0000
committerRoland McGrath <roland@gnu.org>2002-05-05 19:31:46 +0000
commitc8856907c294327114312c87a449f2270b4a1ac5 (patch)
tree58417396f1b1693463d35a725e7c30cafe918704 /trans/fakeroot.c
parent3a32912b45a7c1a22b1b88b9a34264a3536a339f (diff)
2002-05-05 Roland McGrath <roland@frob.com>
* fakeroot.c (netfs_attempt_lookup): Check io_identity result for our own fsys identity port; on match, look up the existing node for the port to ourselves.
Diffstat (limited to 'trans/fakeroot.c')
-rw-r--r--trans/fakeroot.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 3592d720..29f39018 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -364,20 +364,37 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir,
else
{
mach_port_deallocate (mach_task_self (), fsidport);
- mutex_lock (&idport_ihash_lock);
- *np = ihash_find (&idport_ihash, idport);
- if (*np != 0)
+ if (fsidport == netfs_fsys_identity)
{
- /* We already know about this node. */
+ /* Talking to ourselves! We just looked up one of our own nodes.
+ Find the node and return it. */
+ struct protid *cred = ports_lookup_port (netfs_port_bucket, file,
+ netfs_protid_class);
mach_port_deallocate (mach_task_self (), idport);
mach_port_deallocate (mach_task_self (), file);
+ if (cred == 0)
+ return EGRATUITOUS;
+ *np = cred->po->np;
netfs_nref (*np);
- mutex_unlock (&idport_ihash_lock);
+ ports_port_deref (cred);
}
else
{
- mutex_unlock (&idport_ihash_lock);
- err = new_node (file, idport, flags, np);
+ mutex_lock (&idport_ihash_lock);
+ *np = ihash_find (&idport_ihash, idport);
+ if (*np != 0)
+ {
+ /* We already know about this node. */
+ mach_port_deallocate (mach_task_self (), idport);
+ mach_port_deallocate (mach_task_self (), file);
+ netfs_nref (*np);
+ mutex_unlock (&idport_ihash_lock);
+ }
+ else
+ {
+ mutex_unlock (&idport_ihash_lock);
+ err = new_node (file, idport, flags, np);
+ }
}
}
}