* sysdeps/mach/hurd/bind.c (bind): Don't deallocate IFSOCK if we never

set it.
This commit is contained in:
Roland McGrath 2001-12-11 05:04:23 +00:00
parent c3853534af
commit a4969614ea
2 changed files with 18 additions and 15 deletions

View File

@ -1,5 +1,8 @@
2001-12-10 Roland McGrath <roland@frob.com> 2001-12-10 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/bind.c (bind): Don't deallocate IFSOCK if we never
set it.
* shlib-versions [USE_IN_LIBIO] (.*-.*-gnu-gnu.*): Set default * shlib-versions [USE_IN_LIBIO] (.*-.*-gnu-gnu.*): Set default
set to GLIBC_2.2.5, not GLIBC_2.2.4. set to GLIBC_2.2.5, not GLIBC_2.2.4.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc. /* Copyright (C) 1992,94,95,96,97,98,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -58,7 +58,6 @@ bind (fd, addrarg, len)
if (! err) if (! err)
{ {
file_t ifsock;
/* Set the node's translator to make it a local-domain socket. */ /* Set the node's translator to make it a local-domain socket. */
err = __file_set_translator (node, err = __file_set_translator (node,
FS_TRANS_EXCL | FS_TRANS_SET, FS_TRANS_EXCL | FS_TRANS_SET,
@ -77,27 +76,28 @@ bind (fd, addrarg, len)
if (! err) if (! err)
{ {
/* Get a port to the ifsock translator. */ /* Get a port to the ifsock translator. */
ifsock = __file_name_lookup_under (dir, n, 0, 0); file_t ifsock = __file_name_lookup_under (dir, n, 0, 0);
if (ifsock == MACH_PORT_NULL) if (ifsock == MACH_PORT_NULL)
{ {
err = errno; err = errno;
/* If we failed, get rid of the node we created. */ /* If we failed, get rid of the node we created. */
__dir_unlink (dir, n); __dir_unlink (dir, n);
} }
} else
if (! err)
{ {
/* Get the address port. */ /* Get the address port. */
err = __ifsock_getsockaddr (ifsock, &aport); err = __ifsock_getsockaddr (ifsock, &aport);
if (err == MIG_BAD_ID || err == EOPNOTSUPP) if (err == MIG_BAD_ID || err == EOPNOTSUPP)
/* We are not talking to /hurd/ifsock. Probably someone /* We are not talking to /hurd/ifsock. Probably
came in after we linked our node, unlinked it, and someone came in after we linked our node, unlinked
replaced it with a different node, before we did our it, and replaced it with a different node, before we
lookup. Treat it as if our link had failed with EEXIST. */ did our lookup. Treat it as if our link had failed
with EEXIST. */
err = EADDRINUSE; err = EADDRINUSE;
} }
__mach_port_deallocate (__mach_task_self (), ifsock); __mach_port_deallocate (__mach_task_self (), ifsock);
} }
}
__mach_port_deallocate (__mach_task_self (), dir); __mach_port_deallocate (__mach_task_self (), dir);
if (err) if (err)