diff Modules/socketmodule.c @ 20378:2f89b344fdb3 legacy-trunk

Use PySocket_Err() instead of PyErr_SetFromErrno(). The former does the right thing on Windows, the latter does not.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Thu, 11 Oct 2001 17:27:58 +0000
parents 9c2d444674d0
children b47168178d87
line wrap: on
line diff
--- a/Modules/socketmodule.c	Thu Oct 11 17:23:34 2001 +0000
+++ b/Modules/socketmodule.c	Thu Oct 11 17:27:58 2001 +0000
@@ -850,7 +850,7 @@
 		strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name));
 		ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0';
 		if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) {
-			PyErr_SetFromErrno(PySocket_Error);
+			PySocket_Err();
 			return 0;
 		}
 		addr = &(s->sock_addr.ll);
@@ -2530,8 +2530,7 @@
 			/* the underlying BIO reported an I/O error */
 			Py_DECREF(v);
 			Py_DECREF(n);
-			PyErr_SetFromErrno(PyExc_IOError);
-			return NULL;
+			return PySocket_Err();
 		} else {
 			/* XXX Protected by global interpreter lock */
 			errstr = ERR_error_string(e, NULL);