From: Neal Norwitz Date: Wed, 2 Nov 2005 05:36:37 +0000 (+0000) Subject: Cleanup the previous checkin. X-Git-Tag: v2.5a0~1203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6eac2005bfdb1c2e48c8ebba234c61cc9ab9c4c6;p=thirdparty%2FPython%2Fcpython.git Cleanup the previous checkin. Close the fd in the close method and invalidated it. Don't try to close a second time when deallocating. --- diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 73797cb5fe28..51487a744647 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;