diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-15 08:20:11 +0000 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-15 08:20:11 +0000 |
commit | 43403781bb74830a11e32be3079cf759a4ecf6da (patch) | |
tree | cd374337a56430f5683f60a9f0c3fead05a43547 /Modules/mmapmodule.c | |
parent | 386308bc577b0c8f2d64202dfdbe8c3ceb832a6e (diff) | |
download | cpython-43403781bb74830a11e32be3079cf759a4ecf6da.tar.gz |
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 49fe7f7c72..e47211f171 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 */ |