summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2009-02-11 23:45:25 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2009-02-11 23:45:25 (GMT)
commit3605b5cee3ae86e014c015242dd82e2f46ba5c5f (patch)
treeab8c02a90076fb304150d1b9b08752c477f5521e /Modules
parentbcd3ea86a39b80b1a3614f4a06a42c0ec7519f0a (diff)
downloadcpython-3605b5cee3ae86e014c015242dd82e2f46ba5c5f.zip
cpython-3605b5cee3ae86e014c015242dd82e2f46ba5c5f.tar.gz
cpython-3605b5cee3ae86e014c015242dd82e2f46ba5c5f.tar.bz2
Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index fc85bcc..9cefe04 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3769,8 +3769,11 @@ socket_inet_aton(PyObject *self, PyObject *args)
#endif
#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK)
+#if (SIZEOF_INT != 4)
+#error "Not sure if in_addr_t exists and int is not 32-bits."
+#endif
/* Have to use inet_addr() instead */
- unsigned long packed_addr;
+ unsigned int packed_addr;
#endif
char *ip_addr;
@@ -5305,7 +5308,10 @@ int
inet_pton(int af, const char *src, void *dst)
{
if (af == AF_INET) {
- long packed_addr;
+#if (SIZEOF_INT != 4)
+#error "Not sure if in_addr_t exists and int is not 32-bits."
+#endif
+ unsigned int packed_addr;
packed_addr = inet_addr(src);
if (packed_addr == INADDR_NONE)
return 0;