summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/bind.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/bind.c')
-rw-r--r--sysdeps/mach/hurd/bind.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/bind.c b/sysdeps/mach/hurd/bind.c
index fae826d534..c057500348 100644
--- a/sysdeps/mach/hurd/bind.c
+++ b/sysdeps/mach/hurd/bind.c
@@ -48,7 +48,7 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
return -1;
/* Create a new, unlinked node in the target directory. */
- err = __dir_mkfile (dir, O_CREAT, 0666 & ~_hurd_umask, &node);
+ err = __dir_mkfile (dir, O_CREAT, 0666, &node);
if (! err)
{
@@ -76,11 +76,16 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
err = EGRATUITOUS;
if (! err)
{
- /* Link the node, now a socket with proper mode, into the
- target directory. */
- err = __dir_link (dir, node, n, 1);
- if (err == EEXIST)
- err = EADDRINUSE;
+ /* Fix the access mode before showing the file. */
+ err = __file_chmod (node, 0666 & ~_hurd_umask);
+ if (! err)
+ {
+ /* Link the node, now a socket with proper mode, into the
+ target directory. */
+ err = __dir_link (dir, node, n, 1);
+ if (err == EEXIST)
+ err = EADDRINUSE;
+ }
if (err)
__mach_port_deallocate (__mach_task_self (), aport);
}