summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_fileio.c2
-rw-r--r--Modules/socketmodule.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 339a1d7..1ed6417 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -146,7 +146,7 @@ check_fd(int fd)
{
#if defined(HAVE_FSTAT)
struct stat buf;
- if (fstat(fd, &buf) < 0 && errno == EBADF) {
+ if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) {
PyObject *exc;
char *msg = strerror(EBADF);
exc = PyObject_CallFunction(PyExc_OSError, "(is)",
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index f9f486e..35809ee 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3567,8 +3567,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;
@@ -5090,7 +5093,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;