diff options
-rw-r--r-- | socket/sys/un.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/socket/sys/un.h b/socket/sys/un.h index 454eafebc9..2b11300e28 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -34,10 +34,11 @@ struct sockaddr_un #ifdef __USE_MISC +# include <stddef.h> # 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 |