summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-06-14 04:48:42 +0000
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-06-14 04:48:42 +0000
commit86c8efc3bbe7e2cefe15d941ff9edd725da192c0 (patch)
treec7a94ac0c69cc820494e5d379b0c1ebbeb2445e2
parent1cfa3926f9067ed486bf46af44dcc83c64084a57 (diff)
downloadcpython-git-86c8efc3bbe7e2cefe15d941ff9edd725da192c0.tar.gz
Merged revisions 73425 via svnmerge from
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. ........
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/mmapmodule.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 24018acf4a..dcc2b81e8d 100644
--- 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
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index cbacc2fc25..1d0f490d5a 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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);