diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-02-21 16:44:05 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-02-21 16:44:05 (GMT) |
commit | f2f373f5931be48efc3f6fa2c2faa1cca79dce75 (patch) | |
tree | 87facdec6423b6282ad5c4e2cf30e124d4a5de40 /Modules/mmapmodule.c | |
parent | 18d1924987d75ef43a429fe4b6f05df2c308ec2a (diff) | |
download | cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.zip cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.tar.gz cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.tar.bz2 |
Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r-- | Modules/mmapmodule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 1371424..ac134b8 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -459,8 +459,8 @@ mmap_size_method(mmap_object *self, #ifdef UNIX { - struct stat buf; - if (-1 == fstat(self->fd, &buf)) { + struct _Py_stat_struct buf; + if (-1 == _Py_fstat(self->fd, &buf)) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } @@ -1107,7 +1107,7 @@ static PyObject * new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) { #ifdef HAVE_FSTAT - struct stat st; + struct _Py_stat_struct st; #endif mmap_object *m_obj; PyObject *map_size_obj = NULL; @@ -1174,7 +1174,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) (void)fcntl(fd, F_FULLFSYNC); #endif #ifdef HAVE_FSTAT - if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { + if (fd != -1 && _Py_fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { if (map_size == 0) { if (st.st_size == 0) { PyErr_SetString(PyExc_ValueError, |