From: Roland McGrath Date: Fri, 8 Feb 2013 22:55:50 +0000 (-0800) Subject: Fix PF_LOCAL socket example sockaddr_un size calculation. X-Git-Tag: glibc-2.18~729 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=550a0b89b464356c5fa44b16a28f49ab1df5b04a;p=platform%2Fupstream%2Fglibc.git Fix PF_LOCAL socket example sockaddr_un size calculation. --- diff --git a/ChangeLog b/ChangeLog index 27cbc6d..f3c8d4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-02-08 Roland McGrath + + * manual/examples/mkfsock.c (make_named_socket): Don't add one for + the '\0' terminator. + 2013-02-08 Joseph Myers [BZ #13550] diff --git a/manual/examples/mkfsock.c b/manual/examples/mkfsock.c index 1469e02..1a2b7f1 100644 --- a/manual/examples/mkfsock.c +++ b/manual/examples/mkfsock.c @@ -45,13 +45,12 @@ make_named_socket (const char *filename) /* The size of the address is the offset of the start of the filename, - plus its length, - plus one for the terminating null byte. + plus its length (not including the terminating null byte). Alternatively you can just do: size = SUN_LEN (&name); */ size = (offsetof (struct sockaddr_un, sun_path) - + strlen (name.sun_path) + 1); + + strlen (name.sun_path)); if (bind (sock, (struct sockaddr *) &name, size) < 0) {