diff options
author | Sergiu Ivanov <unlimitedscolobb@gmail.com> | 2009-01-30 10:27:58 +0200 |
---|---|---|
committer | Sergiu Ivanov <unlimitedscolobb@gmail.com> | 2009-01-30 10:27:58 +0200 |
commit | 0a878aaf9fadb891a6067f8f084baa8ca5c30521 (patch) | |
tree | 53e590a43e077f181103b8a677c46abf3cf5de1b | |
parent | eeba2e52b08c78f2ba362174c8bfc8d222133b45 (diff) |
Adapted node_set_translator to setting translators on shadow nodes
Usually the file of which the supplied node is a mirror is
looked up by node_set_translator, so that it can open using
the flag combination required by the translator being started.
However, when dealing with a dynamic translator being set upon
another dynamic translator, node_set_translator must not do any
lookups, because a valid port is already stored in the supplied
node.
-rw-r--r-- | node.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -202,6 +202,7 @@ error_t node_create_from_port (mach_port_t port, node_t ** node) /*setup the information in the netnode */ node_new->nn->flags = 0; node_new->nn->ncache_next = node_new->nn->ncache_prev = NULL; + node_new->nn->port = port; /*initialize the data fields dealing with positioning this node in the dynamic translator stack */ @@ -790,12 +791,16 @@ error_t if (err) return err; - /*Open the ports to underlying real file as required by the - translator */ - np->nn->port = file_name_lookup_under - (diruser->po->np->nn->port, filename, flags, 0); - if(!np->nn->port) - return ENOENT; + if (!np->nn->port) + { + /*We have to do the lookup only in case the supplied node does + not already have a port. */ + + np->nn->port = file_name_lookup_under + (diruser->po->np->nn->port, filename, flags, 0); + if (!np->nn->port) + return ENOENT; + } /*Duplicate the supplied user */ err = iohelp_dup_iouser (&user, diruser->user); |