From: Guido van Rossum Date: Mon, 10 Apr 2000 12:45:45 +0000 (+0000) Subject: In dealloc(), only close the socket if fd != -1. X-Git-Tag: v1.6a2~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa972c987c394507ca6fb76de5ef0b47e9301226;p=thirdparty%2FPython%2Fcpython.git In dealloc(), only close the socket if fd != -1. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index bc8c9ae6175e..b96ba657af52 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1356,7 +1356,8 @@ static PyMethodDef PySocketSock_methods[] = { static void BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s) { - (void) close(s->sock_fd); + if (s->sock_fd != -1) + (void) close(s->sock_fd); PyMem_DEL(s); }