aboutsummaryrefslogtreecommitdiff
path: root/socket
diff options
context:
space:
mode:
authorNick Lewycky <nlewycky@google.com>2015-04-16 11:15:58 -0700
committerNick Lewycky <nlewycky@google.com>2015-04-16 11:15:58 -0700
commite19fc0ea57ac535c6aa28b58655cfcabfcf738d8 (patch)
treed24c5412de4de65e61d24c1ee0578f40d96a040f /socket
parent2963bd873faf3eb3be33cca3a2ef3401ec088962 (diff)
downloadglibc-e19fc0ea57ac535c6aa28b58655cfcabfcf738d8.tar.xz
glibc-e19fc0ea57ac535c6aa28b58655cfcabfcf738d8.zip
Change this offsetof computation to use c89 offsetof. Tested:
Diffstat (limited to 'socket')
-rw-r--r--socket/sys/un.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/socket/sys/un.h b/socket/sys/un.h
index fc0ed39cd8..fdb6f944d4 100644
--- a/socket/sys/un.h
+++ b/socket/sys/un.h
@@ -34,10 +34,11 @@ struct sockaddr_un
#ifdef __USE_MISC
+# include <stddef.h> /* For offsetof. */
# include <string.h> /* For prototype of `strlen'. */
/* Evaluate to actual length of the `sockaddr_un' structure. */
-# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+# define SUN_LEN(ptr) (offsetof(struct sockaddr_un, sun_path) \
+ strlen ((ptr)->sun_path))
#endif