X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsockets.c;h=39939b0a3eb10516dc9ec36bfae736cc03043db9;hb=efbbfb91034a125333b7b147bc6a32170b25c890;hp=42b8f9ea58e19b1ef06d4c8e66e55c2b998f9a10;hpb=6110d07dee40692d43f2ef8884230e0d53c56548;p=gnulib.git diff --git a/lib/sockets.c b/lib/sockets.c index 42b8f9ea5..39939b0a3 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -28,6 +28,7 @@ # include # include "fd-hook.h" +# include "msvc-nothrow.h" /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" @@ -37,6 +38,10 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list, gl_close_fn primary, int fd) { + /* Note about multithread-safety: There is a race condition where, between + our calls to closesocket() and the primary close(), some other thread + could make system calls that allocate precisely the same HANDLE value + as sock; then the primary close() would call CloseHandle() on it. */ SOCKET sock; WSANETWORKEVENTS ev;