summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 08:02:37 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 08:02:37 (GMT)
commitdbfb9b89db6cf2f1bc63c9be9bfab476d7141181 (patch)
treea1dc9d0216b8a8fb847de9379f99012f6ba802f0 /Modules/mmapmodule.c
parente697e3750f1273df0968193eea167c83a60f4c84 (diff)
downloadcpython-dbfb9b89db6cf2f1bc63c9be9bfab476d7141181.zip
cpython-dbfb9b89db6cf2f1bc63c9be9bfab476d7141181.tar.gz
cpython-dbfb9b89db6cf2f1bc63c9be9bfab476d7141181.tar.bz2
Issue 12404: Remove C89 incompatible code from mmap module.
Patch by Akira Kitada.
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 36ca67d..da9283b 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1140,12 +1140,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,