[Python-checkins] python/dist/src/Modules mmapmodule.c,2.45,2.46

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Tue, 15 Jul 2003 05:37:48 -0700


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

Modified Files:
	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.45
retrieving revision 2.46
diff -C2 -d -r2.45 -r2.46
*** mmapmodule.c	3 May 2003 09:14:53 -0000	2.45
--- mmapmodule.c	15 Jul 2003 12:37:46 -0000	2.46
***************
*** 902,906 ****
  	fsync(fd);
  #  endif
! 	if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) {
  		PyErr_SetString(PyExc_ValueError, 
  				"mmap length is greater than file size");
--- 902,907 ----
  	fsync(fd);
  #  endif
! 	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");