]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1355] ntp-dev won't compile on OpenBSD 4.6.
authorDave Hart <hart@ntp.org>
Sun, 25 Oct 2009 11:25:16 +0000 (11:25 +0000)
committerDave Hart <hart@ntp.org>
Sun, 25 Oct 2009 11:25:16 +0000 (11:25 +0000)
bk: 4ae4359cZMokfQh0wQ6R2iD-aL3JdQ

32 files changed:
ChangeLog
include/Makefile.am
include/l_stdlib.h
include/lib_strbuf.h [moved from libntp/lib_strbuf.h with 100% similarity]
include/ntp_io.h
include/ntp_net.h
include/ntp_stdlib.h
include/ntp_types.h
include/ntpsim.h
libntp/Makefile.am
libntp/decodenetnum.c
libntp/inttoa.c
libntp/msyslog.c
libntp/ntp_random.c
libntp/numtoa.c
libntp/numtohost.c
libntp/socktoa.c
libntp/socktohost.c
ntpd/keyword-gen.c
ntpd/ntp_control.c
ntpd/ntp_intres.c
ntpd/ntp_request.c
ntpdc/ntpdc_ops.c
ports/winnt/include/netinet/in.h [deleted file]
ports/winnt/include/netinet/in_system.h [deleted file]
ports/winnt/include/netinet/ip.h [deleted file]
ports/winnt/include/sys/socket.h [deleted file]
ports/winnt/vc6/libntp.dsp
ports/winnt/vs2003/libntp.vcproj
ports/winnt/vs2005/libntp.vcproj
ports/winnt/vs2008/libntp/libntp.vcproj
util/ntp-keygen.c

index 11d623c2ea0d358970c7b88a41765ca3dcb76010..ff5d84ddc5dfe8124fb10d57cdd22492c4cd399d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1355] ntp-dev won't compile on OpenBSD 4.6.
 (4.2.5p236-RC) 2009/10/22 Released by Harlan Stenn <stenn@ntp.org>
 * Cleanup from Dave Mills.
 * [Bug 1343] ntpd/ntp_io.c close_fd() does not compile on Solaris 7.
index 26ae9c6a64fa48b0c5ae6850fb8fcbc8f5f829ab..289427962bc673f9a9050c8d1e3fdfe16a4376c1 100644 (file)
@@ -17,6 +17,7 @@ noinst_HEADERS =      \
        ieee754io.h     \
        iosignal.h      \
        l_stdlib.h      \
+       lib_strbuf.h    \
        mbg_gps166.h    \
        mx4200.h        \
        ntif.h          \
index e82040d6991afb6116ff119d2416fc56110d3a0d..0213d23c1c4f78856acfda3d96d5407d25270b51 100644 (file)
 #endif
 
 #include <stdarg.h>
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
 
 /* Needed for speed_t. */
 #ifdef HAVE_TERMIOS_H
similarity index 100%
rename from libntp/lib_strbuf.h
rename to include/lib_strbuf.h
index 194f9d86eb69e9dbc9343e6541d9e7f0a057a9c7..692d4440fc04e74634ac5eece7efa58f0c679b22 100644 (file)
@@ -8,9 +8,7 @@
 # include <config.h>
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
index 5238816397ec9c163dd88123b1d170ad96054e42..9cfebe1c745c35d29697f6833a33cebf58b1b282 100644 (file)
@@ -6,8 +6,12 @@
 #define NTP_NET_H
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 
 #include "ntp_rfc2553.h"
 
index f50717726f2cd695c89c6bc59e4272879e9599b1..90e6e00aac5a86a22b4d1b2c79af601bf95bbad4 100644 (file)
@@ -5,7 +5,9 @@
 #define NTP_STDLIB_H
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
 
 #include "l_stdlib.h"
 #include "ntp_rfc2553.h"
index f74a984c3142c401983932e5c7d5efcdfad2799a..ed6a2ca4b4800411dc2c007999f6d42e316d6000 100644 (file)
@@ -4,12 +4,12 @@
  *  as int and u_int.
  *  For 32 bit systems, define them as long and u_long
  */
+#ifndef NTP_TYPES_H
+#define NTP_TYPES_H
+
 #include <sys/types.h>
 #include "ntp_machine.h"
 
-#ifndef _NTP_TYPES_
-#define _NTP_TYPES_
-
 /*
  * This is another naming conflict.
  * On NetBSD for MAC the macro "mac" is defined as 1
@@ -102,5 +102,4 @@ typedef u_int32 tstamp_t;   /* NTP seconds timestamp */
 #endif
 
 
-#endif /* _NTP_TYPES_ */
-
+#endif /* NTP_TYPES_H */
index 29e205d850dae46fe1d88840bac213e71a385c7a..dbbfea0576d96e5a20d0abf5b95c686192254ca1 100644 (file)
@@ -2,18 +2,20 @@
  *
  * The header file for the ntp discrete event simulator. 
  *
- * Written By: Sachin Kamboj
- *             University of Delaware
- *             Newark, DE 19711
+ * Written By: Sachin Kamboj
+ *             University of Delaware
+ *             Newark, DE 19711
  * Copyright (c) 2006
  */
 
-#ifndef __NTPSIM_H__
-#define __NTPSIM_H__
+#ifndef NTPSIM_H
+#define NTPSIM_H
 
 #include <stdio.h>
 #include <math.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
 #include <arpa/inet.h>
 #include "ntp_syslog.h"
 #include "ntp_fp.h"
@@ -25,7 +27,6 @@
 #include "ntp_io.h"
 #include "ntp_stdlib.h"
 
-/* #include "config.tab.h"*/         /* Bison generated header file for flex */
 #include "ntp_data_structures.h"
 
 /* CONSTANTS */
@@ -140,4 +141,4 @@ double       poisson                 (double, double);
 int      yyparse                 (void);
 void     create_server_associations (void);
 
-#endif
+#endif /* NTPSIM_H */
index 946cb424efe319aae6378df07434745571bf4bae..5ec437791ab6ca7323e3f979f19714ee874ee22b 100644 (file)
@@ -54,8 +54,6 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
        -I$(top_srcdir)/lib/isc/unix/include
 ETAGS_ARGS = Makefile.am
 
-noinst_HEADERS = lib_strbuf.h 
-
 ../include/des.h:
        touch ../include/des.h
 
index 83ef78b45faa262b67d99376a31056645ab43dc1..1ce98ae891bf54fbc8e84227890066a0b85f7119 100644 (file)
@@ -1,10 +1,15 @@
 /*
  * decodenetnum - return a net number (this is crude, but careful)
  */
+#include <config.h>
 #include <sys/types.h>
 #include <ctype.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 
 #include "ntp_stdlib.h"
 #include "ntp_assert.h"
index f2707333980909980dd4506bcc27c18f33081faf..b9c585c0b1fde68624255f640f2ddc4b12edb444 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * inttoa - return an asciized signed integer
  */
+#include <config.h>
 #include <stdio.h>
 
 #include "lib_strbuf.h"
@@ -8,13 +9,13 @@
 
 char *
 inttoa(
-       long ival
+       long val
        )
 {
        register char *buf;
 
        LIB_GETBUF(buf);
+       snprintf(buf, sizeof(buf), "%ld", val);
 
-       (void) sprintf(buf, "%ld", (long)ival);
        return buf;
 }
index 4e2bb4bc232edb22e228e317bf887e281a98f6c8..43466b81c93126f0e07d8ed64d515bd432bb3914 100644 (file)
@@ -9,9 +9,7 @@
 # include <config.h>
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
index b6db2c06429fb379761863a61f94c07c11f2db1c..c982a0d0ac1aa86d4cedeabf3ff0b7c53329c135 100644 (file)
@@ -39,9 +39,7 @@ static char sccsid[] = "@(#)random.c  8.2 (Berkeley) 5/19/95";
 #endif /* LIBC_SCCS and not lint */
 
 #include "config.h"
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
index 2a77ea2ab267827b90ecc04586040474055f1643..36a7c5819a4cfa6db2e226d8f1f676831e46078b 100644 (file)
@@ -1,11 +1,10 @@
 /*
  * numtoa - return asciized network numbers store in local array space
  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
-#if HAVE_NETINET_IN_H
+#include <sys/types.h>
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>                /* ntohl */
 #endif
 
index e81dd42ac0a54850dbe7937236a9a483a9ef5ff0..b3d458ee06136a732723c0e11e8605e559e58f13 100644 (file)
@@ -1,12 +1,10 @@
 /*
  * numtohost - convert network number to host name.
  */
-
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
-#if HAVE_NETINET_IN_H
+#include <sys/types.h>
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>                /* ntohl */
 #endif
 
index c78470cf4f02256d1d80b35f5141a4df7604ec73..bd97e6806adf7d4879bdcedf8a03f0dfb0361ba8 100644 (file)
@@ -7,8 +7,12 @@
 #endif
 
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 
 #include <arpa/inet.h>
 
index 616bf74fe3a98d8e0e55cf57697c6629fe49ad4c..325eea40da4a33e9c4e0ee79e0b200d9b427c469 100644 (file)
@@ -2,8 +2,12 @@
  * socktoa - return a numeric host name from a sockaddr_storage structure
  */
 #include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 
 #include <arpa/inet.h>
 
index 5ef11890818a2cde5813e33cd824d22aab99900b..7c2ea9e0aed01cf0a5b40f0a5b43c5b84112eb6c 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <ntp_stdlib.h>
 #include <ntp_config.h>
-#include "../libntp/lib_strbuf.h"
+#include <lib_strbuf.h>
 #include "ntp_scanner.h"
 #include "ntp_parser.h"
 
index 8d2f3919f7bb4e0294d36a08b2b8fac3be239e81..3ab0bb6aa4dd64cc4ce3ed5fbf942f93c96164ac 100644 (file)
@@ -20,7 +20,9 @@
 #include <signal.h>
 #include <sys/stat.h>
 
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #include <arpa/inet.h>
 
 /*
index 9180af59b4e5b98c7b20177b6a96c52404f024bc..45ee089c85a26a3a20e201928d7bc1b993f329b6 100644 (file)
@@ -32,7 +32,9 @@
 #include <signal.h>
 
 /**/
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #include <arpa/inet.h>
 /**/
 #ifdef HAVE_SYS_PARAM_H
index 925f3dbde792b498552daf1922b1bd336ae392c0..a3af3416659d73fa287de05f468df1ce1813771c 100644 (file)
@@ -18,7 +18,9 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <signal.h>
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #include <arpa/inet.h>
 
 #include "recvbuff.h"
index 161e8a50dde9dc65bd4db294f3b17595de1b034d..20627615de067dff0dc1037eadc08a9c1c0df41c 100644 (file)
 # include <sys/timex.h>
 #endif
 #if !defined(__bsdi__) && !defined(apollo)
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
+#endif
 
 #include <arpa/inet.h>
 
@@ -2657,6 +2659,7 @@ clockstat(
        struct info_clock *cl;
        /* 8 is the maximum number of clocks which will fit in a packet */
        u_long clist[min(MAXARGS, 8)];
+       int qitemc;
        int qitems;
        int items;
        int itemsize;
@@ -2664,7 +2667,9 @@ clockstat(
        l_fp ts;
        struct clktype *clk;
 
-       for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++)
+       qitemc = min(pcmd->nargs, COUNTOF(clist));
+
+       for (qitems = 0; qitems < qitemc; qitems++)
                clist[qitems] = NSRCADR(&pcmd->argval[qitems].netnum);
 
 again:
@@ -2678,13 +2683,13 @@ again:
        }
 
        if (res != 0)
-           return;
+               return;
 
        if (!checkitems(items, fp))
-           return;
+               return;
 
        if (!checkitemsize(itemsize, sizeof(struct info_clock)))
-           return;
+               return;
 
        while (items-- > 0) {
                (void) fprintf(fp, "clock address:        %s\n",
diff --git a/ports/winnt/include/netinet/in.h b/ports/winnt/include/netinet/in.h
deleted file mode 100644 (file)
index 5e15997..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/**************************************************************
- * Dummy Header for Unix to Windows NT portability
- * Created for NTP package
- **************************************************************/
diff --git a/ports/winnt/include/netinet/in_system.h b/ports/winnt/include/netinet/in_system.h
deleted file mode 100644 (file)
index 5e15997..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/**************************************************************
- * Dummy Header for Unix to Windows NT portability
- * Created for NTP package
- **************************************************************/
diff --git a/ports/winnt/include/netinet/ip.h b/ports/winnt/include/netinet/ip.h
deleted file mode 100644 (file)
index 5e15997..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/**************************************************************
- * Dummy Header for Unix to Windows NT portability
- * Created for NTP package
- **************************************************************/
diff --git a/ports/winnt/include/sys/socket.h b/ports/winnt/include/sys/socket.h
deleted file mode 100644 (file)
index 5e15997..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/**************************************************************
- * Dummy Header for Unix to Windows NT portability
- * Created for NTP package
- **************************************************************/
index d54810ae0b068ae758259c7fb1dd9ea6a00edff9..0f215ec9a87d4b656779bc72344375a8cc6f0b97 100644 (file)
@@ -510,7 +510,7 @@ SOURCE=..\..\..\include\l_stdlib.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\lib_strbuf.h
+SOURCE=..\..\..\include\lib_strbuf.h
 # End Source File
 # Begin Source File
 
index ba1dce414cee7fd983dfed4006ca2296b54d65cc..d6a5e70606f02ba46a9657ababa8716ba841cba2 100644 (file)
                                RelativePath="..\..\..\include\l_stdlib.h">
                        </File>
                        <File
-                               RelativePath="..\..\..\libntp\lib_strbuf.h">
+                               RelativePath="..\..\..\include\lib_strbuf.h">
                        </File>
                        <File
                                RelativePath="..\..\..\lib\isc\include\isc\log.h">
index fc34adcd4729ec753535afa8ec179d44c44c12bf..02d3b6874230bb5e0ac760e2197bf52997f3d51a 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\libntp\lib_strbuf.h"
+                               RelativePath="..\..\..\include\lib_strbuf.h"
                                >
                        </File>
                        <File
index e508ac251c540521fa5425d8f6905d8a320e2054..c47c2663e752c00e8b031bfaab1376b4bc62375c 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\..\libntp\lib_strbuf.h"
+                               RelativePath="..\..\..\..\include\lib_strbuf.h"
                                >
                        </File>
                        <File
index ce6381d266ad665dcb96c0c75c1dd2732f086bcc..fb8cc36c71f8e2a1f2d4775f8b96dd4b5977b422 100644 (file)
@@ -87,9 +87,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
 #include "ntp_types.h"
 #include "ntp_random.h"
 #include "l_stdlib.h"
 
 #include "ntp-keygen-opts.h"
 
-#ifdef SYS_WINNT
-extern int     ntp_getopt      (int, char **, const char *);
-#define getopt ntp_getopt
-#define optarg ntp_optarg
-#endif /* SYS_WINNT */
-
 #ifdef OPENSSL
 #include "openssl/bn.h"
 #include "openssl/evp.h"