1163
1163
if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
1166
1170
if (offset >= st.st_size) {
1167
1171
PyErr_SetString(PyExc_ValueError,
1168
1172
"mmap offset is greater than file size");
1174
1176
PyErr_SetString(PyExc_ValueError,
1175
1177
"mmap length is too large");
1178
1181
} else if (offset + (size_t)map_size > st.st_size) {
1179
1182
PyErr_SetString(PyExc_ValueError,
1180
1183
"mmap length is greater than file size");