[Python-checkins] python/dist/src/Modules socketmodule.c, 1.311, 1.312
birkenfeld@users.sourceforge.net
birkenfeld at users.sourceforge.net
Fri Aug 26 10:34:10 CEST 2005
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7523/Modules
Modified Files:
socketmodule.c
Log Message:
patch [ 756021 ] Allow socket.inet_aton("255.255.255.255") on Windows
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.311
retrieving revision 1.312
diff -u -d -r1.311 -r1.312
--- socketmodule.c 7 Nov 2004 14:24:25 -0000 1.311
+++ socketmodule.c 26 Aug 2005 08:34:00 -0000 1.312
@@ -3238,14 +3238,19 @@
return NULL;
#else /* ! HAVE_INET_ATON */
- /* XXX Problem here: inet_aton('255.255.255.255') raises
- an exception while it should be a valid address. */
- packed_addr = inet_addr(ip_addr);
+ /* special-case this address as inet_addr might return INADDR_NONE
+ * for this */
+ if (strcmp(ip_addr, "255.255.255.255") == 0) {
+ packed_addr = 0xFFFFFFFF;
+ } else {
+
+ packed_addr = inet_addr(ip_addr);
- if (packed_addr == INADDR_NONE) { /* invalid address */
- PyErr_SetString(socket_error,
- "illegal IP address string passed to inet_aton");
- return NULL;
+ if (packed_addr == INADDR_NONE) { /* invalid address */
+ PyErr_SetString(socket_error,
+ "illegal IP address string passed to inet_aton");
+ return NULL;
+ }
}
return PyString_FromStringAndSize((char *) &packed_addr,
sizeof(packed_addr));
More information about the Python-checkins
mailing list