From patchwork Thu Sep 18 17:07:48 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: clarify code intent Date: Thu, 18 Sep 2008 07:07:48 -0000 From: Mathieu Lacage X-Patchwork-Id: 540 Message-Id: <1221757668.23007.12.camel@ns-test> To: netdev@vger.kernel.org hi, The attached patch hopefully clarifies the intent of the unix_bind function in net/unix/af_unix.c. That 'feature' (the ability to delegate the endpoint allocation to the kernel with bind by sending a sockaddr_un.sun_family = AF_UNIX rather than have to wait until the autobind is triggered by a later call to send) would be nice to document in the unix '7' manpage but, I have no idea where these are maintained. I also have no idea whether that specific 'feature' is common among other unixes. It is quite useful though. Mathieu diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 015606b..efa725e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -777,7 +777,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) if (sunaddr->sun_family != AF_UNIX) goto out; - if (addr_len==sizeof(short)) { + if (addr_len==sizeof(sa_family_t)) { err = unix_autobind(sock); goto out; }