[icinga-checkins] icinga.org: icinga2/master: Fix setsockopt() error on Windows

git at icinga.org git at icinga.org
Tue Jul 5 13:17:23 CEST 2016


Module: icinga2
Branch: master
Commit: 85afec895204a6d01c96edc5ef86cab8c71927e0
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=85afec895204a6d01c96edc5ef86cab8c71927e0

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Tue Jul  5 13:16:14 2016 +0200

Fix setsockopt() error on Windows

refs #12003

---

 lib/base/tcpsocket.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/base/tcpsocket.cpp b/lib/base/tcpsocket.cpp
index 02b1054..453c20e 100644
--- a/lib/base/tcpsocket.cpp
+++ b/lib/base/tcpsocket.cpp
@@ -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 */



More information about the icinga-checkins mailing list