From 3ee30bd0f733f8dfc7e4b161c1a48a04db631258 Mon Sep 17 00:00:00 2001 From: Sorata Kasugano <884244164@qq.com> Date: Mon, 14 May 2018 16:18:18 +0800 Subject: [PATCH 1/3] Fix a logic default --- .gitignore | 3 +++ src/Win32_Interop/Win32_FDAPI.cpp | 23 +---------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 708c5c05d58..443078d0b59 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,6 @@ msvs/BuildRelease msvs/Documentation tests/tmp/ +*.db +*.opendb +api/ \ No newline at end of file diff --git a/src/Win32_Interop/Win32_FDAPI.cpp b/src/Win32_Interop/Win32_FDAPI.cpp index 3df9af17922..c87c8f66372 100644 --- a/src/Win32_Interop/Win32_FDAPI.cpp +++ b/src/Win32_Interop/Win32_FDAPI.cpp @@ -1001,28 +1001,7 @@ int FDAPI_fileno(FILE *file) { } int FDAPI_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { - try { - if (readfds != NULL) { - for (u_int r = 0; r < readfds->fd_count; r++) { - readfds->fd_array[r] = RFDMap::getInstance().lookupSocket((RFD) readfds->fd_array[r]); - } - } - if (writefds != NULL) { - for (u_int r = 0; r < writefds->fd_count; r++) { - writefds->fd_array[r] = RFDMap::getInstance().lookupSocket((RFD) writefds->fd_array[r]); - } - } - if (exceptfds != NULL) { - for (u_int r = 0; r < exceptfds->fd_count; r++) { - exceptfds->fd_array[r] = RFDMap::getInstance().lookupSocket((RFD) exceptfds->fd_array[r]); - } - } - - return f_select(nfds, readfds, writefds, exceptfds, timeout); - } CATCH_AND_REPORT(); - - errno = EBADF; - return SOCKET_ERROR; + return f_select(nfds, readfds, writefds, exceptfds, timeout); } u_int FDAPI_ntohl(u_int netlong){ From 2e8a82394815f6e900f9421e06caac52f13749d6 Mon Sep 17 00:00:00 2001 From: Sorata Kasugano <884244164@qq.com> Date: Thu, 17 May 2018 09:44:44 +0800 Subject: [PATCH 2/3] fix a incorrect FD_SETSIZE check --- src/Win32_Interop/Win32_FDAPI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Win32_Interop/Win32_FDAPI.cpp b/src/Win32_Interop/Win32_FDAPI.cpp index c87c8f66372..36a4ed9c060 100644 --- a/src/Win32_Interop/Win32_FDAPI.cpp +++ b/src/Win32_Interop/Win32_FDAPI.cpp @@ -674,7 +674,7 @@ int FDAPI_poll(struct pollfd *fds, nfds_t nfds, int timeout) { if (fds[i].fd == INVALID_SOCKET) { continue; } - if (pollCopy[i].fd >= FD_SETSIZE) { + if (fds[i].fd >= FD_SETSIZE) { errno = EINVAL; return -1; } From 5c2f6eb16204269082c35cd9582ac512aadf944f Mon Sep 17 00:00:00 2001 From: Sorata Kasugano <884244164@qq.com> Date: Thu, 17 May 2018 09:55:19 +0800 Subject: [PATCH 3/3] fix a incorrect check about INVALID_SOCKET --- src/Win32_Interop/Win32_FDAPI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Win32_Interop/Win32_FDAPI.cpp b/src/Win32_Interop/Win32_FDAPI.cpp index 36a4ed9c060..197b79910ef 100644 --- a/src/Win32_Interop/Win32_FDAPI.cpp +++ b/src/Win32_Interop/Win32_FDAPI.cpp @@ -671,7 +671,7 @@ int FDAPI_poll(struct pollfd *fds, nfds_t nfds, int timeout) { nfds_t i; for (i = 0; i < nfds; i++) { - if (fds[i].fd == INVALID_SOCKET) { + if (pollCopy[i].fd == INVALID_SOCKET) { continue; } if (fds[i].fd >= FD_SETSIZE) {