diff options
author | Roland McGrath <roland@hack.frob.com> | 2013-02-08 14:55:50 -0800 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2013-02-08 14:55:50 -0800 |
commit | 550a0b89b464356c5fa44b16a28f49ab1df5b04a (patch) | |
tree | 6c850ea30c1dfcb00468be54e2148908b7d55c97 /manual/examples/mkfsock.c | |
parent | 3392138235f454f2b9375a26d78c0c35808dd087 (diff) | |
download | glibc-550a0b89b464356c5fa44b16a28f49ab1df5b04a.tar.gz glibc-550a0b89b464356c5fa44b16a28f49ab1df5b04a.tar.xz glibc-550a0b89b464356c5fa44b16a28f49ab1df5b04a.zip |
Fix PF_LOCAL socket example sockaddr_un size calculation.
Diffstat (limited to 'manual/examples/mkfsock.c')
-rw-r--r-- | manual/examples/mkfsock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/manual/examples/mkfsock.c b/manual/examples/mkfsock.c index 1469e02fc4..1a2b7f19fb 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) { |