[Python-checkins] r73425 - in python/trunk: Misc/NEWS Modules/mmapmodule.c

hirokazu.yamamoto python-checkins at python.org
Sun Jun 14 05:53:55 CEST 2009


Author: hirokazu.yamamoto
Date: Sun Jun 14 05:53:55 2009
New Revision: 73425

Log:
Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
(On Unix) Patch by STINNER Victor.

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Modules/mmapmodule.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Jun 14 05:53:55 2009
@@ -325,6 +325,9 @@
 Library
 -------
 
+- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
+  (On Unix)
+
 - Issue #6215: All bug fixes and enhancements from the Python 3.1 io library
   (including the fast C implementation) have been backported to the standard
   ``io`` module.

Modified: python/trunk/Modules/mmapmodule.c
==============================================================================
--- python/trunk/Modules/mmapmodule.c	(original)
+++ python/trunk/Modules/mmapmodule.c	Sun Jun 14 05:53:55 2009
@@ -158,7 +158,8 @@
 #endif /* MS_WINDOWS */
 
 #ifdef UNIX
-	(void) close(self->fd);
+	if (0 <= self->fd)
+		(void) close(self->fd);
 	self->fd = -1;
 	if (self->data != NULL) {
 		munmap(self->data, self->size);


More information about the Python-checkins mailing list