summaryrefslogtreecommitdiff
path: root/Xtranssock.c
diff options
context:
space:
mode:
Diffstat (limited to 'Xtranssock.c')
-rw-r--r--Xtranssock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Xtranssock.c b/Xtranssock.c
index 07dc297..a144e08 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -1108,7 +1108,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
sockname.sun_len = strlen(sockname.sun_path);
namelen = SUN_LEN(&sockname);
#else
- namelen = strlen(sockname.sun_path) + sizeof(sockname.sun_family);
+ namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path);
#endif
unlink (sockname.sun_path);
@@ -1998,7 +1998,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
sockname.sun_len = strlen (sockname.sun_path);
namelen = SUN_LEN (&sockname);
#else
- namelen = strlen (sockname.sun_path) + sizeof (sockname.sun_family);
+ namelen = strlen (sockname.sun_path) + offsetof(struct sockaddr_un, sun_path);
#endif
@@ -2012,7 +2012,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
return TRANS_CONNECT_FAILED;
}
old_namelen = strlen (old_sockname.sun_path) +
- sizeof (old_sockname.sun_family);
+ offsetof(struct sockaddr_un, sun_path);
#endif