netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* clarify code intent
@ 2008-09-18 17:07 Mathieu Lacage
  2008-09-18 23:36 ` David Miller
  2008-09-23  0:29 ` Andi Kleen
  0 siblings, 2 replies; 5+ messages in thread
From: Mathieu Lacage @ 2008-09-18 17:07 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

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

[-- Attachment #2: p --]
[-- Type: text/x-patch, Size: 405 bytes --]

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-23  0:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 17:07 clarify code intent Mathieu Lacage
2008-09-18 23:36 ` David Miller
2008-09-18 23:53   ` Mathieu Lacage
2008-09-18 23:59     ` David Miller
2008-09-23  0:29 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).