From 6ed236d51adf6d0a848e7bf882d6ee4d138fe663 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sun, 10 Oct 2010 07:10:59 +0200 Subject: [PATCH] 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 Signed-off-by: Michael Kerrisk --- man7/unix.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man7/unix.7 b/man7/unix.7 index 4a1b46a8f..60570b9d0 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -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.