[Python-checkins] python/dist/src/Modules mmapmodule.c,2.35.6.5,2.35.6.6

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Tue, 15 Jul 2003 06:00:48 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv22275

Modified Files:
      Tag: release22-maint
	mmapmodule.c 
Log Message:
[Patch #708374] Only apply the check for file size if the file is a regular file, not a character or block device.

Index: mmapmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v
retrieving revision 2.35.6.5
retrieving revision 2.35.6.6
diff -C2 -d -r2.35.6.5 -r2.35.6.6
*** mmapmodule.c	7 Feb 2003 19:46:44 -0000	2.35.6.5
--- mmapmodule.c	15 Jul 2003 13:00:45 -0000	2.35.6.6
***************
*** 898,902 ****
  
  #ifdef HAVE_FSTAT
! 	if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) {
  		PyErr_SetString(PyExc_ValueError, 
  				"mmap length is greater than file size");
--- 898,903 ----
  
  #ifdef HAVE_FSTAT
! 	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");