diff options
author | Petr Salinger <petr.salinger@t-systems.cz> | 2006-04-23 01:31:00 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2006-08-24 17:36:59 -0700 |
commit | 2495789d6c290e2037b2836f28b027786ea5b605 (patch) | |
tree | 5ba54e972b51aeda02410c87e5e3c87769b6e5fc | |
parent | 2633eaf8824828433a0eb9c9f3c4263b50342473 (diff) |
Bug 4982: use offsetof for manipulating struct sockaddr_un
X.Org Bugzilla #4982 <https://bugs.freedesktop.org/show_bug.cgi?id=4982>
Patch #5424 <https://bugs.freedesktop.org/attachment.cgi?id=5424>
-rw-r--r-- | Xtranssock.c | 6 |
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 |