socklen_t mylen = sizeof(*sun);
const struct sockaddr *sa = *sa_r;
+ /* If this isn't a Unix-domain socket then there's nothing to do. */
+ if (real_getsockname(sk, SA(sun), &mylen) < 0) return (-1);
+ if (sun->sun_family != AF_UNIX) return (0);
+ if (mylen < sizeof(*sun)) ((char *)sun)[mylen] = 0;
+
/* If we're allowed to talk to a real remote endpoint, then fix things up
* as necessary and proceed.
*/
return (0);
}
- /* If this isn't a Unix-domain socket then there's nothing to do. */
- if (real_getsockname(sk, SA(sun), &mylen) < 0) return (-1);
- if (sun->sun_family != AF_UNIX) return (0);
- if (mylen < sizeof(*sun)) ((char *)sun)[mylen] = 0;
-
/* Speaking of which, if we don't have a local address, then we should
* arrange one now.
*/