summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 08:11:44 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 08:11:44 (GMT)
commit1db37f3248697d0a6fa24cea6b7112651f0e4abb (patch)
treed6744f3de96718d6885228d1ba40881e56e15ec0 /Modules
parente71db4450cc3ede22dbfda7c7eb9149cf685650f (diff)
parentdbfb9b89db6cf2f1bc63c9be9bfab476d7141181 (diff)
downloadcpython-1db37f3248697d0a6fa24cea6b7112651f0e4abb.zip
cpython-1db37f3248697d0a6fa24cea6b7112651f0e4abb.tar.gz
cpython-1db37f3248697d0a6fa24cea6b7112651f0e4abb.tar.bz2
Merge with 3.2 (Issue #12404).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index ab12e2c..5d086a7 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1162,12 +1162,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
# endif
if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
if (map_size == 0) {
+ off_t calc_size;
if (offset >= st.st_size) {
PyErr_SetString(PyExc_ValueError,
"mmap offset is greater than file size");
return NULL;
}
- off_t calc_size = st.st_size - offset;
+ calc_size = st.st_size - offset;
map_size = calc_size;
if (map_size != calc_size) {
PyErr_SetString(PyExc_ValueError,