Commit 1aff1d15 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

[Patch #708374] Only apply the check for file size if the file is a regular...

[Patch #708374] Only apply the check for file size if the file is a regular file, not a character or block device.
parent bc7d818c
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment