@@ -1,5 +1,5 @@
/* Server for S_IFSOCK nodes
- Copyright (C) 1994, 1995, 2001, 02, 2006 Free Software Foundation
+ Copyright (C) 1994, 1995, 2001, 02, 2006, 2014 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -134,19 +134,15 @@ error_t
S_ifsock_getsockaddr (struct trivfs_protid *cred,
mach_port_t *address)
{
- int perms;
- error_t err;
-
if (!cred
|| cred->pi.bucket != port_bucket
|| cred->pi.class != node_class)
return EOPNOTSUPP;
- err = file_check_access (cred->realnode, &perms);
- if (!err && !(perms & O_READ))
- err = EACCES;
+ /* Require write access to connect, per POSIX. */
+ if (!(cred->po->openmodes & O_WRITE))
+ return EACCES;
- if (!err)
- *address = address_port;
- return err;
+ *address = address_port;
+ return 0;
}