From: Danny Mayer Date: Wed, 9 Aug 2006 02:38:19 +0000 (-0400) Subject: bug #671: setsockopt needs macro for Windows X-Git-Tag: NTP_4_2_3P28~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c84e75227fb6c5604b512b30ffb7316572a300e;p=thirdparty%2Fntp.git bug #671: setsockopt needs macro for Windows bk: 44d94a9bf6grt_N9r70HkwvOigUQkg --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index de2aa5e41..0031ee6e1 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -39,6 +39,15 @@ # include #endif +/* + * setsockopt does not always have the same arg declaration + * across all platforms. If it's not defined we make it empty + */ + +#ifndef SETSOCKOPT_ARG_CAST +#define SETSOCKOPT_ARG_CAST +#endif + /* * Set up some macros to look for IPv6 and IPv6 multicast */ @@ -1556,7 +1565,7 @@ enable_multicast_if(struct interface *iface, struct sockaddr_storage *maddr) * Don't send back to itself, but allow it to fail to set it */ if (setsockopt(iface->fd, IPPROTO_IP, IP_MULTICAST_LOOP, - &off, sizeof(off)) == -1) { + SETSOCKOPT_ARG_CAST &off, sizeof(off)) == -1) { netsyslog(LOG_ERR, "setsockopt IP_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", iface->fd, stoa(&iface->sin), stoa(maddr)); @@ -2253,11 +2262,7 @@ open_socket( /* * Don't log this under all conditions */ - if (turn_off_reuse == 0 -#ifdef DEBUG - || debug > 1 -#endif - ) + if (turn_off_reuse == 0 || debug > 1) netsyslog(LOG_ERR, buff); closesocket(fd); diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index c21ab1063..cab862e9a 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -67,6 +67,7 @@ #define OPEN_BCAST_SOCKET 1 /* for ntp_io.c */ #define TYPEOF_IP_MULTICAST_LOOP BOOL +#define SETSOCKOPT_ARG_CAST (const char *) #define HAVE_RANDOM #define MAXHOSTNAMELEN 64 #define AUTOKEY