netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
To: netdev@vger.kernel.org
Subject: clarify code intent
Date: Thu, 18 Sep 2008 10:07:48 -0700	[thread overview]
Message-ID: <1221757668.23007.12.camel@ns-test> (raw)

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

             reply	other threads:[~2008-09-18 17:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 17:07 Mathieu Lacage [this message]
2008-09-18 23:36 ` clarify code intent David Miller
2008-09-18 23:53   ` Mathieu Lacage
2008-09-18 23:59     ` David Miller
2008-09-23  0:29 ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1221757668.23007.12.camel@ns-test \
    --to=mathieu.lacage@sophia.inria.fr \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).