Subject: clarify code intent

From: Mathieu Lacage <[email-masked]>
Date: Thu, 18 Sep 2008 10:07:48 -0700

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;
 	}