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>
As reported by Lennart Poettering:
The part about "abstract" sockets is misleading as it suggests
that the sockaddr returned by getsockname() would necessarily
have the size of sizeof(struct sockaddr), which however is not
the case: getsockname() returns exactly the sockaddr size that
was passed in on bind(). In particular, two sockets that are
bound to the same sockaddr but different sizes are completely
independent.
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>
Programmers often make the mistake of including a feature test
macro only after having already included some header files.
This patch adds some text at opportune places to remind
programmers to do things the right way.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
PF_ constants have always had the same values; there never has
been a protocol family that had more than one address family,
and POSIX.1-2001 only specifies the AF_* constants.
PF_ constants have always had the same values; there never has
been a protocol family that had more than one address family,
and POSIX.1-2001 only specifies the AF_* constants.
Various pages use inconsistent terms for 'null byte' (which
is the C99/SUSv3 term for the '\0' character).
To rectify this the following changes were made in these pages:
Replace 'zero byte' with 'null byte'.
Replace 'null character' with 'null byte'.
Replace 'nulls' with 'null bytes'.
Replace 'NUL-terminated' by 'null-terminated'.
Replace 'NUL' by 'null byte'.
Replace 'terminating NUL' by 'terminating null byte'.
Replace 'final NUL' by 'terminating null byte'.
Replace 'NUL character' by 'null byte'.