Commit e1c4104b authored by Neal Norwitz's avatar Neal Norwitz

Cleanup the previous checkin.

Close the fd in the close method and invalidated it.  Don't try
to close a second time when deallocating.
parent b784c2a4
...@@ -99,7 +99,8 @@ mmap_object_dealloc(mmap_object *m_obj) ...@@ -99,7 +99,8 @@ mmap_object_dealloc(mmap_object *m_obj)
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef UNIX #ifdef UNIX
close(m_obj->fd); if (m_obj->fd >= 0)
(void) close(m_obj->fd);
if (m_obj->data!=NULL) { if (m_obj->data!=NULL) {
msync(m_obj->data, m_obj->size, MS_SYNC); msync(m_obj->data, m_obj->size, MS_SYNC);
munmap(m_obj->data, m_obj->size); munmap(m_obj->data, m_obj->size);
...@@ -137,6 +138,8 @@ mmap_close_method(mmap_object *self, PyObject *args) ...@@ -137,6 +138,8 @@ mmap_close_method(mmap_object *self, PyObject *args)
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef UNIX #ifdef UNIX
(void) close(self->fd);
self->fd = -1;
if (self->data != NULL) { if (self->data != NULL) {
munmap(self->data, self->size); munmap(self->data, self->size);
self->data = NULL; self->data = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment