Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b63179 commit 6eac200Copy full SHA for 6eac200
1 file changed
Modules/mmapmodule.c
@@ -99,7 +99,8 @@ mmap_object_dealloc(mmap_object *m_obj)
99
#endif /* MS_WINDOWS */
100
101
#ifdef UNIX
102
- close(m_obj->fd);
+ if (m_obj->fd >= 0)
103
+ (void) close(m_obj->fd);
104
if (m_obj->data!=NULL) {
105
msync(m_obj->data, m_obj->size, MS_SYNC);
106
munmap(m_obj->data, m_obj->size);
@@ -137,6 +138,8 @@ mmap_close_method(mmap_object *self, PyObject *args)
137
138
139
140
141
+ (void) close(self->fd);
142
+ self->fd = -1;
143
if (self->data != NULL) {
144
munmap(self->data, self->size);
145
self->data = NULL;
0 commit comments