[Fix] Fixed some win32 potential bugs (by @zeliard)
(cherry picked from commit 02edfe4101a18d512717f9a7c4b8fd9eecf7fbac) Conflicts: src/Win32_Interop/Win32_FDAPI.cpp
This commit is contained in:
@@ -559,7 +559,7 @@ int redis_poll_impl(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
|
||||
nfds_t i;
|
||||
for (i = 0; i < nfds; i++) {
|
||||
if (fds[i].fd < 0) {
|
||||
if (fds[i].fd == INVALID_SOCKET) {
|
||||
continue;
|
||||
}
|
||||
if (pollCopy[i].fd >= FD_SETSIZE) {
|
||||
@@ -1218,7 +1218,7 @@ BOOL ParseStorageAddress(const char *ip, int port, SOCKADDR_STORAGE* pSotrageAdd
|
||||
/* Setting AI_PASSIVE will give you a wildcard address if addr is NULL */
|
||||
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE;
|
||||
|
||||
if ((status = getaddrinfo(ip, port_buffer, &hints, &res) != 0)) {
|
||||
if ((status = getaddrinfo(ip, port_buffer, &hints, &res)) != 0) {
|
||||
//fprintf(stderr, "getaddrinfo: %S\n", gai_strerror(status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int replace_random() {
|
||||
RtlGenRandom = (RtlGenRandomFunc)GetProcAddress(lib, "SystemFunction036");
|
||||
if (RtlGenRandom == NULL) return 1;
|
||||
}
|
||||
RtlGenRandom(&x, sizeof(UINT_MAX));
|
||||
RtlGenRandom(&x, sizeof(unsigned int));
|
||||
return (int)(x >> 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user