[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:
Enrico Giordani
2015-07-22 09:57:16 +02:00
parent 05382e53b1
commit 1a65d62922
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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);
}