set fd to -1 on close.

This commit is contained in:
Joris Vink 2019-03-21 10:09:24 +01:00
parent d371454dad
commit ce012e7bd5
1 changed files with 2 additions and 1 deletions

View File

@ -1935,9 +1935,10 @@ pysocket_close(struct pysocket *sock, PyObject *args)
sock->socket = NULL;
} else if (sock->fd != -1) {
(void)close(sock->fd);
sock->fd = -1;
}
sock->fd = -1;
Py_RETURN_TRUE;
}