]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1780] Windows ntpd 4.2.7p114 crashes in ioctl().
authorDave Hart <hart@ntp.org>
Sat, 8 Jan 2011 10:54:12 +0000 (10:54 +0000)
committerDave Hart <hart@ntp.org>
Sat, 8 Jan 2011 10:54:12 +0000 (10:54 +0000)
bk: 4d284254F9zO1X2o2ToWkvUvtLxQjQ

ChangeLog
libntp/socket.c
ntpd/ntp_io.c

index caba3c0c37a4461320301f28c82ce068c8b7fe0e..1a07c319b5dbff7bc1453e829175dc51e0451624 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1780] Windows ntpd 4.2.7p114 crashes in ioctl().
 (4.2.7p114) 2011/01/08 Released by Harlan Stenn <stenn@ntp.org>
 * Fix for openssl pkg-config detection eval failure.
 * Add erealloc_zero(), refactor estrdup(), emalloc(), emalloc_zero() to
index 32417feeee351665623e44f72dc7d674a6fe1e9e..d117c83c16d6e6253a87fe458ed618bc2ef78e8f 100644 (file)
 
 #include <isc/util.h>
 
+/*
+ * Windows C runtime ioctl() can't deal properly with sockets, 
+ * map to ioctlsocket for this source file.
+ */
+#ifdef SYS_WINNT
+#define ioctl(fd, opt, val)  ioctlsocket(fd, opt, (u_long *)(val))
+#endif
+
 /* HMS: Is this the best place to put the qos global? */
 
 #if defined(HAVE_IPTOS_SUPPORT)
index 3e63a2655604f3a6c8542b2d52fefc6433c2b959..20a803cbf3d43e78330aad7f41f494f97023f09b 100644 (file)
@@ -102,12 +102,7 @@ nic_rule *nic_rule_list;
 #if defined(SYS_WINNT)
 #include "win32_io.h"
 #include <isc/win32os.h>
-/*
- * Windows C runtime ioctl() can't deal properly with sockets, 
- * map to ioctlsocket for this source file.
- */
-#define ioctl(fd, opt, val)  ioctlsocket((fd), (opt), (u_long *)(val))
-#endif  /* SYS_WINNT */
+#endif
 
 /*
  * We do asynchronous input using the SIGIO facility.  A number of
@@ -2892,69 +2887,6 @@ io_multicast_del(
 }
 
 
-#if 0
-/* MOVED to libntp/socket.c, to become part of libntp. */
-/*
- * init_nonblocking_io() - set up descriptor to be non blocking
- */
-static void init_nonblocking_io(
-       SOCKET fd
-       )
-{
-       /*
-        * set non-blocking,
-        */
-
-#ifdef USE_FIONBIO
-       /* in vxWorks we use FIONBIO, but the others are defined for old systems, so
-        * all hell breaks loose if we leave them defined
-        */
-#undef O_NONBLOCK
-#undef FNDELAY
-#undef O_NDELAY
-#endif
-
-#if defined(O_NONBLOCK) /* POSIX */
-       if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
-               msyslog(LOG_ERR,
-                       "fcntl(O_NONBLOCK) fails on fd #%d: %m", fd);
-               exit(1);
-       }
-#elif defined(FNDELAY)
-       if (fcntl(fd, F_SETFL, FNDELAY) < 0) {
-               msyslog(LOG_ERR, "fcntl(FNDELAY) fails on fd #%d: %m",
-                       fd);
-               exit(1);
-       }
-#elif defined(O_NDELAY) /* generally the same as FNDELAY */
-       if (fcntl(fd, F_SETFL, O_NDELAY) < 0) {
-               msyslog(LOG_ERR, "fcntl(O_NDELAY) fails on fd #%d: %m",
-                       fd);
-               exit(1);
-       }
-#elif defined(FIONBIO)
-       {
-               int on = 1;
-
-               if (ioctl(fd, FIONBIO, &on) < 0) {
-                       msyslog(LOG_ERR,
-                               "ioctl(FIONBIO) fails on fd #%d: %m",
-                               fd);
-                       exit(1);
-               }
-       }
-#elif defined(FIOSNBIO)
-       if (ioctl(fd, FIOSNBIO, &on) < 0) {
-               msyslog(LOG_ERR,
-                       "ioctl(FIOSNBIO) fails on fd #%d: %m", fd);
-               exit(1);
-       }
-#else
-# include "Bletch: Need non-blocking I/O!"
-#endif
-}
-#endif /* 0 */
-
 /*
  * open_socket - open a socket, returning the file descriptor
  */