]> granicus.if.org Git - python/commitdiff
Merged revisions 73425 via svnmerge from
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Sun, 14 Jun 2009 04:58:16 +0000 (04:58 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Sun, 14 Jun 2009 04:58:16 +0000 (04:58 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73425 | hirokazu.yamamoto | 2009-06-14 12:53:55 +0900 | 2 lines

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

Misc/NEWS
Modules/mmapmodule.c

index 9ed8b16b93fcac353e1dc9c4ebf860a7ebb522f9..407681b3d65bf55adc09ad9518196c87bc11ec42 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
+  (On Unix)
+
 
 What's New in Python 3.1 Release Candidate 2?
 =============================================
index fd247abd56b342f446ffe7f7d86480e57583f0b4..37584e222559f70eb46529d0839eaba7e2c5cf95 100644 (file)
@@ -164,7 +164,8 @@ mmap_close_method(mmap_object *self, PyObject *unused)
 #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);