summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/bind.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-07-28 22:25:57 +0000
committerMiles Bader <miles@gnu.org>1995-07-28 22:25:57 +0000
commit221c50840f70dcc54dd66494c7d8b4c785e9f180 (patch)
tree068ec00a802da38c9182e9375125e1239a69aa47 /sysdeps/mach/hurd/bind.c
parentb8dc6a10ee55180805ea956ec5be3d001169c4ba (diff)
(bind): Don't use file_invoke_translator, as it doesn't work. Instead just lookup the translated node again, and hope we're not hit by any race conditions.
Diffstat (limited to 'sysdeps/mach/hurd/bind.c')
-rw-r--r--sysdeps/mach/hurd/bind.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/bind.c b/sysdeps/mach/hurd/bind.c
index e9e54ec8dc..2e3f5bfb36 100644
--- a/sysdeps/mach/hurd/bind.c
+++ b/sysdeps/mach/hurd/bind.c
@@ -63,15 +63,41 @@ DEFUN(bind, (fd, addr, len),
MACH_PORT_NULL,
MACH_MSG_TYPE_COPY_SEND);
if (! err)
+ /* Link the node, now a socket, into the target directory. */
+ err = __dir_link (node, dir, n);
+ if (! err)
/* Get a port to the ifsock translator. */
- err = __hurd_invoke_translator (node, 0, &ifsock);
+ {
+ retry_type retry;
+ string_t retry_name;
+
+ err = __dir_lookup (dir, n, 0, 0, &retry, retry_name, &ifsock);
+
+ if (! err && (retry != FS_RETRY_NORMAL || retry_name[0]))
+ /* Either someone has fucked with our new node, or the ifsock
+ translator is acting very oddly. */
+ {
+ struct hurd_userlink crdir_ulink;
+ file_t crdir =
+ _hurd_port_get (&_hurd_ports[INIT_PORT_CRDIR],
+ &crdir_ulink);
+
+ err = __hurd_file_name_lookup_retry (crdir,
+ retry, retry_name, 0, 0,
+ &ifsock);
+
+ _hurd_port_free (&_hurd_ports[INIT_PORT_CRDIR],
+ &crdir_ulink, crdir);
+ }
+
+ if (err)
+ /* If we failed, get rid of the node we created. */
+ __dir_unlink (dir, n);
+ }
if (! err)
/* Get the address port. */
err = __ifsock_getsockaddr (ifsock, &aport);
__mach_port_deallocate (__mach_task_self (), ifsock);
- if (! err)
- /* Link the node, now a socket, into the target directory. */
- err = __dir_link (node, dir, name);
__mach_port_deallocate (__mach_task_self (), node);
}
__mach_port_deallocate (__mach_task_self (), dir);