summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-15 08:20:11 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-15 08:20:11 (GMT)
commit7adfad850a50722464775d57b5d16b850ecab56a (patch)
tree876709cd5987e91a120a0d9af22764663237f9e6 /Modules/mmapmodule.c
parent2f0da53d28b316197a94919c96195a514acc668f (diff)
downloadcpython-7adfad850a50722464775d57b5d16b850ecab56a.zip
cpython-7adfad850a50722464775d57b5d16b850ecab56a.tar.gz
cpython-7adfad850a50722464775d57b5d16b850ecab56a.tar.bz2
Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 49fe7f7..e47211f 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1122,6 +1122,10 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
"mmap invalid access parameter.");
}
+ if (prot == PROT_READ) {
+ access = ACCESS_READ;
+ }
+
#ifdef HAVE_FSTAT
# ifdef __VMS
/* on OpenVMS we must ensure that all bytes are written to the file */