]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3441] Validate the assumption that AF_UNSPEC is 0
authorHarlan Stenn <stenn@ntp.org>
Sun, 15 Oct 2017 04:51:52 +0000 (04:51 +0000)
committerHarlan Stenn <stenn@ntp.org>
Sun, 15 Oct 2017 04:51:52 +0000 (04:51 +0000)
bk: 59e2e968XKGrphyhEOk7m52Oh1txTw

ChangeLog
configure.ac
sntp/m4/ntp_af_unspec.m4 [new file with mode: 0644]

index 468f8645afb5108b7a3b6e36ab2b3ab7a8650e3d..0e1f576d2b20d60f9c84467caff8599b50ad0998 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 ---
 
+* [Bug 3441] Validate the assumption that AF_UNSPEC is 0.  stenn@ntp.org
 * [Bug 3439] When running multiple commands / hosts in ntpq... <perlinger@ntp.org>
  - applied patch by ggarvey
 * [Bug 3438] Negative values and values > 999 days in... <perlinger@ntp.org>
index e0775b1c11840631111ad522a3daebaf4b42efea..4e7e06af6167cc53029314299f1c81353cfea903 100644 (file)
@@ -528,6 +528,8 @@ AC_CHECK_HEADERS([sys/timex.h], [], [], [
     #endif
 ])
 
+NTP_AF_UNSPEC
+
 AC_TYPE_SIGNAL
 AC_TYPE_OFF_T
 AC_STRUCT_TM   dnl defines TM_IN_SYS_TIME used by refclock_parse.c
diff --git a/sntp/m4/ntp_af_unspec.m4 b/sntp/m4/ntp_af_unspec.m4
new file mode 100644 (file)
index 0000000..cdb453d
--- /dev/null
@@ -0,0 +1,23 @@
+dnl ######################################################################
+dnl AF_UNSPEC checks
+AC_DEFUN([NTP_AF_UNSPEC], [
+
+# We could do a cv check here, but is it worth it?
+
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM(
+    [[
+       #include <sys/socket.h>
+       #ifndef AF_UNSPEC
+       #include "Bletch: AF_UNSPEC is undefined!"
+       #endif
+       #if AF_UNSPEC != 0
+       #include "Bletch: AF_UNSPEC != 0"
+       #endif
+    ]],
+    [AC_MSG_NOTICE([AF_UNSPEC is zero, as expected.])],
+    [AC_MSG_ERROR([AF_UNSPEC is not zero on this platform!])]
+  )]
+)])
+
+dnl ######################################################################