1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Use 'offsetof' to avoid undefined behavior.

* libguile/socket.c (SUN_LEN): Use 'offsetof'.
This commit is contained in:
Mark H Weaver 2014-03-11 20:31:38 -04:00
parent 03cce0ce5f
commit 9fcee9da3f

View file

@ -64,7 +64,7 @@
#if defined (HAVE_UNIX_DOMAIN_SOCKETS) && !defined (SUN_LEN)
#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