summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-09 19:31:02 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-09 19:31:02 (GMT)
commit69c2b883922a758ed84de2cf94b5485d7e078fd3 (patch)
treedf82a48486d9fca898504cfab5e894f1cb6e8420 /Modules
parent21123ab7e5f79c8f035ccf80ac09725cdb679a36 (diff)
downloadcpython-69c2b883922a758ed84de2cf94b5485d7e078fd3.zip
cpython-69c2b883922a758ed84de2cf94b5485d7e078fd3.tar.gz
cpython-69c2b883922a758ed84de2cf94b5485d7e078fd3.tar.bz2
Fix two crashes on Windows:
- CHECK_VALID() was checking the wrong value for a closed fd - fseek(&_iob[fileno], ...) doesn't work for fileno >= 20
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index fcec0de..c2c723c 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -154,7 +154,7 @@ mmap_close_method(mmap_object *self, PyObject *args)
#ifdef MS_WINDOWS
#define CHECK_VALID(err) \
do { \
- if (!self->map_handle) { \
+ if (self->map_handle == INVALID_HANDLE_VALUE) { \
PyErr_SetString (PyExc_ValueError, "mmap closed or invalid"); \
return err; \
} \
@@ -974,7 +974,7 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
return NULL;
}
/* Win9x appears to need us seeked to zero */
- fseek(&_iob[fileno], 0, SEEK_SET);
+ lseek(fileno, 0, SEEK_SET);
}
m_obj = PyObject_New (mmap_object, &mmap_object_type);