]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
bug #671: setsockopt needs macro for Windows
authorDanny Mayer <mayer@ntp.org>
Wed, 9 Aug 2006 02:38:19 +0000 (22:38 -0400)
committerDanny Mayer <mayer@ntp.org>
Wed, 9 Aug 2006 02:38:19 +0000 (22:38 -0400)
bk: 44d94a9bf6grt_N9r70HkwvOigUQkg

ntpd/ntp_io.c
ports/winnt/include/config.h

index de2aa5e411083f8e58511c911d29492995f75e38..0031ee6e18b153c7814c844a9ae978698e61cb13 100644 (file)
 # include <sys/sockio.h>
 #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);
index c21ab106307817c2a3377ec09ded882d3af91c45..cab862e9a8fdb03e625039669d0d04c26ed36e0d 100644 (file)
@@ -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