Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 17274:6dc43e0c6bbf 2.0
- #125981 -- socketmodule.c -- closing sockets was not thread-safe.
- Use openssl/*.h to include the OpenSSL header files
- Patch #103636: Allow writing strings containing null bytes to an SSL socket
| author | Moshe Zadka <moshez@math.huji.ac.il> |
|---|---|
| date | Sat, 31 Mar 2001 07:13:29 +0000 |
| parents | c654b2018403 |
| children |
line wrap: on
line diff
--- a/Modules/socketmodule.c Sat Mar 31 06:48:52 2001 +0000 +++ b/Modules/socketmodule.c Sat Mar 31 07:13:29 2001 +0000 @@ -156,12 +156,12 @@ #endif #ifdef USE_SSL -#include "rsa.h" -#include "crypto.h" -#include "x509.h" -#include "pem.h" -#include "ssl.h" -#include "err.h" +#include "openssl/rsa.h" +#include "openssl/crypto.h" +#include "openssl/x509.h" +#include "openssl/pem.h" +#include "openssl/ssl.h" +#include "openssl/err.h" #endif /* USE_SSL */ #if defined(MS_WINDOWS) || defined(__BEOS__) @@ -898,14 +898,15 @@ static PyObject * PySocketSock_close(PySocketSockObject *s, PyObject *args) { + SOCKET_T fd; if (!PyArg_ParseTuple(args, ":close")) return NULL; - if (s->sock_fd != -1) { + if ((fd = s->sock_fd) != -1) { + s->sock_fd = -1; Py_BEGIN_ALLOW_THREADS - (void) SOCKETCLOSE(s->sock_fd); + (void) SOCKETCLOSE(fd); Py_END_ALLOW_THREADS } - s->sock_fd = -1; Py_INCREF(Py_None); return Py_None; } @@ -2132,7 +2133,7 @@ char *data; size_t len = 0; - if (!PyArg_ParseTuple(args, "s|i:write", &data, &len)) + if (!PyArg_ParseTuple(args, "s#|i:write", &data, &len)) return NULL; if (!len)
