summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-11-02 05:36:37 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-11-02 05:36:37 (GMT)
commit6eac2005bfdb1c2e48c8ebba234c61cc9ab9c4c6 (patch)
treeb153a5430cf86d2f5110d29ec7abfcdcf2c06cc1 /Modules
parent7b631793abc97edbcd26af56864961e264a86a24 (diff)
downloadcpython-6eac2005bfdb1c2e48c8ebba234c61cc9ab9c4c6.zip
cpython-6eac2005bfdb1c2e48c8ebba234c61cc9ab9c4c6.tar.gz
cpython-6eac2005bfdb1c2e48c8ebba234c61cc9ab9c4c6.tar.bz2
Cleanup the previous checkin.
Close the fd in the close method and invalidated it. Don't try to close a second time when deallocating.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 73797cb..51487a7 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -99,7 +99,8 @@ mmap_object_dealloc(mmap_object *m_obj)
#endif /* MS_WINDOWS */
#ifdef UNIX
- close(m_obj->fd);
+ if (m_obj->fd >= 0)
+ (void) close(m_obj->fd);
if (m_obj->data!=NULL) {
msync(m_obj->data, m_obj->size, MS_SYNC);
munmap(m_obj->data, m_obj->size);
@@ -137,6 +138,8 @@ mmap_close_method(mmap_object *self, PyObject *args)
#endif /* MS_WINDOWS */
#ifdef UNIX
+ (void) close(self->fd);
+ self->fd = -1;
if (self->data != NULL) {
munmap(self->data, self->size);
self->data = NULL;