]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings.
authorDave Hart <hart@ntp.org>
Fri, 5 Feb 2010 05:07:21 +0000 (05:07 +0000)
committerDave Hart <hart@ntp.org>
Fri, 5 Feb 2010 05:07:21 +0000 (05:07 +0000)
Broaden ylwrap workaround VPATH_HACK to all non-GNU make.

bk: 4b6ba789fNpbO0GqhtvVoV2KLHHLOw

ChangeLog
include/ntp_debug.h
m4/ntp_vpathhack.m4
ntpd/Makefile.am
ntpd/ntp_scanner.c
ntpd/work_fork.c

index cc8636851535e49618d48ab385dc09c4748d4976..bc3bdb7f9f8ce5884fd6d298e01710733fbfdbb9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* Attempts to cure CID 108 CID 118 CID 119 TAINTED_SCALAR warnings.
+* Broaden ylwrap workaround VPATH_HACK to all non-GNU make.
 (4.2.7p16) 2010/02/04 Released by Harlan Stenn <stenn@ntp.org>
 * Include (4.2.6p1-RC4) - [Bug 1474] ntp_keygen LCRYPTO after libntp.a.
 * Include (4.2.6p1-RC4) - Remove arlib.
 * [Bug 1414] Enable "make distcheck" success with BSD make.
 (4.2.7) 2009/12/09 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1407] configure.ac: recent GNU Make -v does not include "version".
+---
+
+* [Bug 1477] 1st non-gmake make in clone w/VPATH can't make COPYRIGHT.
+
 ---
 (4.2.6p1-RC4) 2010/02/04 Released by Harlan Stenn <stenn@ntp.org>
 
index 55b2e1a76d8e6317ff18bb404f94bd9da0272a6d..d07323b85f1aab859c69ff2b83a74fae959f2c4b 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef NTP_DEBUG_H
 #define NTP_DEBUG_H
 
+#include "ntp_assert.h"
+
 /*
  * macros for debugging output - cut down on #ifdef pollution in the code
  */
index 43aea62367cd695541cae00f2e0e071b8124a921..7099fe88d1e142e704757922b5a0a51cd9124d27 100644 (file)
@@ -1,29 +1,43 @@
 dnl ######################################################################
 dnl NTP_VPATH_HACK
 dnl
-dnl Are we using FreeBSD's make?
+dnl Compiling ntpd doesn't require YACC or Bison unless ntp_parser.y is
+dnl modified, because the output ntp_parser.[ch] are committed.  This
+dnl raises an issue with Automake-generated Makefiles on non-GNU make
+dnl used from a build tree outside the source tree.
+dnl
+dnl With GNU make, ylwrap updates $srcdir/ntp_parser.[ch] directly.
+dnl Under Sun or BSD make, ylwrap needs those files to be in the build
+dnl tree.
+dnl
+dnl With VPATH_HACK enabled, ntpd/Makefile.am includes code to symlink
+dnl from ntp_parser.[ch] in the build tree to the corresponding files
+dnl in $srcdir, and to check for ylwrap replacing the .h with a normal
+dnl file, and in that case copy the updated .h to $srcdir and restore
+dnl the symlink.
+dnl
 dnl if we are building outside the srcdir and either
-dnl   force_ntp_vpath_hack is set
+dnl   force_ntp_vpath_hack is yes
 dnl     or
-dnl   we're on freebsd and not using GNU make
-dnl then we want VPATH_HACK to be true in automake tests
+dnl   we're not using GNU make
+dnl then we want VPATH_HACK to be true for .am tests
 dnl
 AC_DEFUN([NTP_VPATH_HACK], [
-AC_MSG_CHECKING([to see if we need a VPATH hack])
+AC_MSG_CHECKING([to see if we need ylwrap VPATH hack])
 ntp_vpath_hack="no"
-case "$srcdir::$build_os::${force_ntp_vpath_hack+set}" in
- .::*::*)
-    ;;
- *::*::set)
+case "$srcdir::${force_ntp_vpath_hack-no}" in
+ .::*)
+    ;; # VPATH_HACK path is for VPATH builds only.
+ *::yes)
     ntp_vpath_hack="yes"
     ;;
- *::freebsd*::)
+ *::*)
     case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in
      '')
        ntp_vpath_hack="yes"
     esac
 esac
-AC_MSG_RESULT($ntp_vpath_hack)
+AC_MSG_RESULT([$ntp_vpath_hack])
 AM_CONDITIONAL([VPATH_HACK], [test x$ntp_vpath_hack = xyes])
 ])
 dnl ======================================================================
index dbf9df47300c93d07abc06442619f2c2cac3c0c1..69dd70772f925e3edeb6a19a1ad9063e0b31a411 100644 (file)
@@ -64,9 +64,9 @@ vphack_after:
                )
 
 # BUILT_SOURCES which should also be in EXTRA_DIST
-B_S_DIST=              \
-       ntpd-opts.c     \
-       ntpd-opts.h     \
+B_S_DIST=                      \
+       $(srcdir)/ntpd-opts.c   \
+       $(srcdir)/ntpd-opts.h   \
        $(NULL)
 
 BUILT_SOURCES=         \
index 009b798d10a594fe9b2d88f4ca0633f3908cee0c..883bd59b0f801c6bcca83138acb9e38297da7326 100644 (file)
@@ -120,14 +120,21 @@ FGETC(
        struct FILE_INFO *stream
        )
 {
-       int ch = fgetc(stream->fd);
+       int ch;
+       
+       ch = fgetc(stream->fd);
 
-       ++stream->col_no;
-       if (ch == '\n') {
-               stream->prev_line_col_no = stream->col_no;
-               ++stream->line_no;
-               stream->col_no = 1;
+       if (EOF != ch) {
+               NTP_INSIST(CHAR_MIN <= ch && ch <= CHAR_MAX);
+
+               ++stream->col_no;
+               if (ch == '\n') {
+                       stream->prev_line_col_no = stream->col_no;
+                       ++stream->line_no;
+                       stream->col_no = 1;
+               }
        }
+
        return ch;
 }
 
index ba93550c142bc15fbbb530a716a824c76fa0e9af..87e271760d48e3098c52afb1206a0a9ab9674b97 100644 (file)
@@ -172,9 +172,15 @@ receive_blocking_req_internal(
        req = NULL;
 
        trycount = 3;
-       do
+       do {
+               NLOG(NLOG_SYSEVENT) {
+                       if (trycount < 3)
+                               msyslog(LOG_NOTICE,
+                                       "receive_blocking_req_internal read try #%d",
+                                       4 - trycount);
+               }
                rc = read(child_req_read_pipe, &hdr, sizeof(hdr));
-       while (--trycount && !rc);
+       while (--trycount && !rc);
 
        if (rc < 0)
                msyslog(LOG_ERR,
@@ -186,6 +192,7 @@ receive_blocking_req_internal(
                        "receive_blocking_req_internal: short header read %d of %d\n",
                        rc, sizeof(hdr));
        else {
+               NTP_INSIST(sizeof(hdr) < hdr.octets && hdr.octets < 4 * 1024);
                req = emalloc(hdr.octets);
                memcpy(req, &hdr, sizeof(*req));
 
@@ -265,6 +272,7 @@ receive_blocking_resp_internal(
                DPRINTF(1, ("receive_blocking_resp_internal: header mismatch (0x%x)\n",
                            hdr.magic_sig));
        else {
+               NTP_INSIST(sizeof(hdr) < hdr.octets && hdr.octets < 16 * 1024);
                resp = emalloc(hdr.octets);
                memcpy(resp, &hdr, sizeof(*resp));