diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-07-15 12:37:46 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-07-15 12:37:46 (GMT) |
commit | a3016678ed5697ae1a21ef328573c714a6d82b8c (patch) | |
tree | 89c52f8de756a6407417ddfc60094d9718cc2744 /Modules | |
parent | c171172614f77190a6b729cd834c27a58eb9aa41 (diff) | |
download | cpython-a3016678ed5697ae1a21ef328573c714a6d82b8c.zip cpython-a3016678ed5697ae1a21ef328573c714a6d82b8c.tar.gz cpython-a3016678ed5697ae1a21ef328573c714a6d82b8c.tar.bz2 |
[Patch #708374] Only apply the check for file size if the file is a regular file, not a character or block device.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mmapmodule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 56033e8..a61a37a 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -901,7 +901,8 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict) /* on OpenVMS we must ensure that all bytes are written to the file */ fsync(fd); # endif - if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) { + if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode) && + (size_t)map_size > st.st_size) { PyErr_SetString(PyExc_ValueError, "mmap length is greater than file size"); return NULL; |