mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
This commit is contained in:
parent
bcd3ea86a3
commit
3605b5cee3
3 changed files with 19 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue