unix.7: Fix description of "pathname" sockets

As reported by Lennart Poettering:

   The part about "pathname" sockets suggests usage of
   sizeof(sa_family_t) + strlen(sun_path) + 1
   for calculating the sockaddr size. Due to alignment/padding
   this is probably not a good idea. Instead, one should use
   offsetof(struct sockaddr_un, sun_path) + strlen() + 1
   or something like that.

See https://bugzilla.kernel.org/show_bug.cgi?id=19812

Reported-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2010-10-10 07:10:59 +02:00
parent 156a0e0d7e
commit 6ed236d51a
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ When the address of the socket is returned by
and
.BR accept (2),
its length is
.IR "sizeof(sa_family_t) + strlen(sun_path) + 1" ,
.IR "offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1" ,
and
.I sun_path
contains the null-terminated pathname.