mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Fix PF_LOCAL socket example sockaddr_un size calculation.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2013-02-08 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* manual/examples/mkfsock.c (make_named_socket): Don't add one for
|
||||||
|
the '\0' terminator.
|
||||||
|
|
||||||
2013-02-08 Joseph Myers <joseph@codesourcery.com>
|
2013-02-08 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
[BZ #13550]
|
[BZ #13550]
|
||||||
|
@ -45,13 +45,12 @@ make_named_socket (const char *filename)
|
|||||||
|
|
||||||
/* The size of the address is
|
/* The size of the address is
|
||||||
the offset of the start of the filename,
|
the offset of the start of the filename,
|
||||||
plus its length,
|
plus its length (not including the terminating null byte).
|
||||||
plus one for the terminating null byte.
|
|
||||||
Alternatively you can just do:
|
Alternatively you can just do:
|
||||||
size = SUN_LEN (&name);
|
size = SUN_LEN (&name);
|
||||||
*/
|
*/
|
||||||
size = (offsetof (struct sockaddr_un, sun_path)
|
size = (offsetof (struct sockaddr_un, sun_path)
|
||||||
+ strlen (name.sun_path) + 1);
|
+ strlen (name.sun_path));
|
||||||
|
|
||||||
if (bind (sock, (struct sockaddr *) &name, size) < 0)
|
if (bind (sock, (struct sockaddr *) &name, size) < 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user