Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Fix a fatal bug caused by logic default in winxp(windows version<6.0) #598

Open
wants to merge 3 commits into
base: 3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ msvs/BuildRelease
msvs/Documentation
tests/tmp/

*.db
*.opendb
api/
27 changes: 3 additions & 24 deletions src/Win32_Interop/Win32_FDAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,10 @@ 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 (pollCopy[i].fd >= FD_SETSIZE) {
if (fds[i].fd >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
Expand Down Expand Up @@ -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){
Expand Down