]> granicus.if.org Git - icinga2/commitdiff
Fix setsockopt() error on Windows
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 5 Jul 2016 11:16:14 +0000 (13:16 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 5 Jul 2016 11:16:14 +0000 (13:16 +0200)
refs #12003

lib/base/tcpsocket.cpp

index 02b105441262f438e0ed7cb49fb21125c786dc01..453c20effa10ba6487c8e8f69bf352c2138efcfe 100644 (file)
@@ -177,8 +177,8 @@ void TcpSocket::Connect(const String& node, const String& service)
                        continue;
                }
 
-               int optval = 1;
-               if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)) != 0) {
+               const int optTrue = 1;
+               if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue)) != 0) {
 #ifdef _WIN32
                        error = WSAGetLastError();
 #else /* _WIN32 */