summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 88d2a70..d5114e8 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1001,7 +1001,7 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
struct sockaddr_un *a = (struct sockaddr_un *) addr;
#ifdef linux
if (a->sun_path[0] == 0) { /* Linux abstract namespace */
- addrlen -= (sizeof(*a) - sizeof(a->sun_path));
+ addrlen -= offsetof(struct sockaddr_un, sun_path);
return PyString_FromStringAndSize(a->sun_path,
addrlen);
}
@@ -1207,7 +1207,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
#if defined(PYOS_OS2)
*len_ret = sizeof(*addr);
#else
- *len_ret = len + sizeof(*addr) - sizeof(addr->sun_path);
+ *len_ret = len + offsetof(struct sockaddr_un, sun_path);
#endif
return 1;
}