Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 51538:edcf996f07e9 legacy-trunk
Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
| author | Gregory P. Smith <greg@mad-scientist.com> |
|---|---|
| date | Wed, 11 Feb 2009 23:45:25 +0000 |
| parents | eb2607a6516e |
| children | 87171283d02f |
line wrap: on
line diff
--- a/Modules/socketmodule.c Wed Feb 11 04:13:06 2009 +0000 +++ b/Modules/socketmodule.c Wed Feb 11 23:45:25 2009 +0000 @@ -3769,8 +3769,11 @@ #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 @@ 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;
