[Python-checkins] python/dist/src/Modules mmapmodule.c,2.43,2.44

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2003年4月09日 12:31:06 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv32370
Modified Files:
	mmapmodule.c 
Log Message:
Fix two crashes on Windows:
- CHECK_VALID() was checking the wrong value for a closed fd
- fseek(&_iob[fileno], ...) doesn't work for fileno >= 20
Index: mmapmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v
retrieving revision 2.43
retrieving revision 2.44
diff -C2 -d -r2.43 -r2.44
*** mmapmodule.c	7 Feb 2003 19:44:56 -0000	2.43
--- mmapmodule.c	9 Apr 2003 19:31:02 -0000	2.44
***************
*** 155,159 ****
 #define CHECK_VALID(err)						\
 do {									\
! if (!self->map_handle) {						\
 	PyErr_SetString (PyExc_ValueError, "mmap closed or invalid");	\
 	return err;							\
--- 155,159 ----
 #define CHECK_VALID(err)						\
 do {									\
! if (self->map_handle == INVALID_HANDLE_VALUE) {						\
 	PyErr_SetString (PyExc_ValueError, "mmap closed or invalid");	\
 	return err;							\
***************
*** 975,979 ****
 		}
 		/* Win9x appears to need us seeked to zero */
! 		fseek(&_iob[fileno], 0, SEEK_SET);
 	}
 
--- 975,979 ----
 		}
 		/* Win9x appears to need us seeked to zero */
! 		lseek(fileno, 0, SEEK_SET);
 	}
 

AltStyle によって変換されたページ (->オリジナル) /