]> 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:48:42 +0000 (04:48 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Sun, 14 Jun 2009 04:48:42 +0000 (04:48 +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 24018acf4a6b639602774f0b4c3c35ae2f78d78c..dcc2b81e8d300685b48e43c931fe32e177d4a6fe 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -56,6 +56,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
+  (On Unix)
+
 - Issue #6258: Support AMD64 in bdist_msi.
 
 - Issue #5262: Fixed bug in next rollover time computation in
index cbacc2fc25222bcd5a20d739d43731d907286ca6..1d0f490d5ab626f1b09c82a7a019dad93c1b1e94 100644 (file)
@@ -158,7 +158,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);