diff options
author | Bruno Haible <bruno@clisp.org> | 2011-05-11 13:14:46 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-05-11 13:14:46 +0200 |
commit | 69a557732a63d666a4578a329860b2bd6c966adc (patch) | |
tree | ac3eb490094bff797f097f9016d63ea674a4c4da /lib/sockets.c | |
parent | d48feb15b4580be907f374c5994c570176669a9e (diff) | |
download | gnulib-69a557732a63d666a4578a329860b2bd6c966adc.tar.gz |
fclose: Fix possible link error.
* lib/fclose.c (rpl_fclose): Invoke _gl_unregister_fd, not
unregister_shadow_fd. Improve comments.
* lib/sockets.c (close_fd_maybe_socket): Add comments. Reported by
Eric Blake.
Diffstat (limited to 'lib/sockets.c')
-rw-r--r-- | lib/sockets.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sockets.c b/lib/sockets.c index 42b8f9ea58..53cb66e468 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -37,6 +37,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; |