invalid win32 accept() check in ev_pipe
Vladimir Ivannikov
v.ivannikov at gaijin.ru
Tue Nov 10 21:28:26 CET 2015
Hello,
There is tiny bug in win32 implementation of ev_pipe() caused by the
fact that accept() returns SOCKET type which is actually UINT_PTR on
windows which of couse unsigned and can't be
signed compared with 0 (compiler will just optimized this check out)
Patch is trivial:
Index: ev_win32.c
===================================================================
RCS file: /schmorpforge/libev/ev_win32.c,v
retrieving revision 1.17
diff -u -3 -w -r1.17 ev_win32.c
--- ev_win32.c 17 Oct 2015 21:47:56 -0000 1.17
+++ ev_win32.c 10 Nov 2015 20:21:53 -0000
@@ -88,7 +88,7 @@
if (connect (sock [0], (struct sockaddr *)&addr, addr_size))
goto fail;
- if ((sock [1] = accept (listener, 0, 0)) < 0)
+ if ((sock [1] = accept (listener, 0, 0)) == INVALID_SOCKET)
goto fail;
/* windows vista returns fantasy port numbers for sockets:
More information about the libev
mailing list