INN commit: branches (56 files)

INN Commit rra at isc.org
Sun Jan 28 21:21:22 UTC 2018


    Date: Sunday, January 28, 2018 @ 13:21:21
  Author: iulius
Revision: 10229

Update to latest C TAP Harness and rra-c-util upstream versions

Also update accordingly the rest of the INN source code.

Added:
  branches/2.6/tests/lib/fakewrite.h
    (from rev 10201, trunk/tests/lib/fakewrite.h)
Modified:
  branches/2.6/	(properties)
  branches/2.6/LICENSE
  branches/2.6/MANIFEST
  branches/2.6/Makefile.global.in
  branches/2.6/configure.ac
  branches/2.6/include/clibrary.h
  branches/2.6/include/inn/network.h
  branches/2.6/include/inn/xmalloc.h
  branches/2.6/include/portable/socket.h
  branches/2.6/innd/perl.c
  branches/2.6/innd/python.c
  branches/2.6/innd/rc.c
  branches/2.6/innfeed/connection.c
  branches/2.6/lib/Makefile
  branches/2.6/lib/getaddrinfo.c
  branches/2.6/lib/inet_aton.c
  branches/2.6/lib/network.c
  branches/2.6/lib/perl.c
  branches/2.6/lib/snprintf.c
  branches/2.6/m4/cc-flags.m4
  branches/2.6/m4/socket.m4
  branches/2.6/nnrpd/nnrpd.c
  branches/2.6/nnrpd/nnrpd.h
  branches/2.6/nnrpd/perl.c
  branches/2.6/nnrpd/python.c
  branches/2.6/support/getc-tap-harness
  branches/2.6/support/getrra-c-util
  branches/2.6/support/mkmanifest
  branches/2.6/tests/Makefile
  branches/2.6/tests/README
  branches/2.6/tests/TESTS
  branches/2.6/tests/docs/pod.t
  branches/2.6/tests/lib/	(properties)
  branches/2.6/tests/lib/asprintf-t.c
  branches/2.6/tests/lib/fakewrite.c
  branches/2.6/tests/lib/inet_aton-t.c
  branches/2.6/tests/lib/inet_ntoa-t.c
  branches/2.6/tests/lib/inet_ntop-t.c
  branches/2.6/tests/lib/messages-t.c
  branches/2.6/tests/lib/network/addr-ipv4-t.c
  branches/2.6/tests/lib/network/addr-ipv6-t.c
  branches/2.6/tests/lib/network/client-t.c
  branches/2.6/tests/lib/network/server-t.c
  branches/2.6/tests/lib/xmalloc.c
  branches/2.6/tests/lib/xwrite-t.c
  branches/2.6/tests/runtests.c
  branches/2.6/tests/tap/basic.c
  branches/2.6/tests/tap/basic.h
  branches/2.6/tests/tap/float.c
  branches/2.6/tests/tap/float.h
  branches/2.6/tests/tap/libtap.sh
  branches/2.6/tests/tap/macros.h
  branches/2.6/tests/tap/process.c
Deleted:
  branches/2.6/lib/memcmp.c
  branches/2.6/tests/lib/memcmp-t.c

-------------------------------------+
 2.6/LICENSE                         |   11 +-
 2.6/MANIFEST                        |    3 
 2.6/Makefile.global.in              |    3 
 2.6/configure.ac                    |    2 
 2.6/include/clibrary.h              |    9 --
 2.6/include/inn/network.h           |    4 
 2.6/include/inn/xmalloc.h           |    2 
 2.6/include/portable/socket.h       |   24 -----
 2.6/innd/perl.c                     |    2 
 2.6/innd/python.c                   |    2 
 2.6/innd/rc.c                       |   14 +--
 2.6/innfeed/connection.c            |   18 +++-
 2.6/lib/Makefile                    |    6 -
 2.6/lib/getaddrinfo.c               |    6 -
 2.6/lib/inet_aton.c                 |    3 
 2.6/lib/memcmp.c                    |   43 ----------
 2.6/lib/network.c                   |   10 +-
 2.6/lib/perl.c                      |    2 
 2.6/lib/snprintf.c                  |  104 ++++++++++++++-----------
 2.6/m4/cc-flags.m4                  |    4 
 2.6/m4/socket.m4                    |   26 ------
 2.6/nnrpd/nnrpd.c                   |    8 -
 2.6/nnrpd/nnrpd.h                   |    1 
 2.6/nnrpd/perl.c                    |    3 
 2.6/nnrpd/python.c                  |    2 
 2.6/support/getc-tap-harness        |   26 ++++--
 2.6/support/getrra-c-util           |    9 --
 2.6/support/mkmanifest              |    3 
 2.6/tests/Makefile                  |    8 -
 2.6/tests/README                    |    2 
 2.6/tests/TESTS                     |    1 
 2.6/tests/docs/pod.t                |    4 
 2.6/tests/lib                       |    1 
 2.6/tests/lib/asprintf-t.c          |    5 -
 2.6/tests/lib/fakewrite.c           |   18 +---
 2.6/tests/lib/fakewrite.h           |   59 ++++++++++++++
 2.6/tests/lib/inet_aton-t.c         |   44 +++++-----
 2.6/tests/lib/inet_ntoa-t.c         |   10 +-
 2.6/tests/lib/inet_ntop-t.c         |   12 +-
 2.6/tests/lib/memcmp-t.c            |   34 --------
 2.6/tests/lib/messages-t.c          |  139 +++++++++++++++++++++++++++-------
 2.6/tests/lib/network/addr-ipv4-t.c |    5 -
 2.6/tests/lib/network/addr-ipv6-t.c |    4 
 2.6/tests/lib/network/client-t.c    |    8 -
 2.6/tests/lib/network/server-t.c    |   32 +++++--
 2.6/tests/lib/xmalloc.c             |   10 --
 2.6/tests/lib/xwrite-t.c            |   33 +++-----
 2.6/tests/runtests.c                |   67 +++++++++-------
 2.6/tests/tap/basic.c               |   60 +++++++++++++-
 2.6/tests/tap/basic.h               |    7 +
 2.6/tests/tap/float.c               |   13 ++-
 2.6/tests/tap/float.h               |    2 
 2.6/tests/tap/libtap.sh             |    2 
 2.6/tests/tap/macros.h              |    2 
 2.6/tests/tap/process.c             |    6 -
 branches/2.6                        |    1 
 56 files changed, 544 insertions(+), 395 deletions(-)

Index: branches/2.6
===================================================================
--- 2.6	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6	2018-01-28 21:21:21 UTC (rev 10229)

Property changes on: branches/2.6
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +1 ##
+/trunk:10199
\ No newline at end of property
Modified: 2.6/LICENSE
===================================================================
--- 2.6/LICENSE	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/LICENSE	2018-01-28 21:21:21 UTC (rev 10229)
@@ -3,7 +3,8 @@
 and license:
 
    Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-       2013, 2014, 2015, 2016 by Internet Systems Consortium, Inc. ("ISC")
+       2013, 2014, 2015, 2016, 2017, 2018
+       by Internet Systems Consortium, Inc. ("ISC")
    Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
        2002, 2003 by The Internet Software Consortium and Rich Salz
 
@@ -30,10 +31,10 @@
    General Public License version 2 or later.  See doc/GPL for a copy of
    the GPL v2.
 
-   backends/shrinkfile.c, frontends/scanspool.in, lib/alloca.c, lib/concat.c,
-   lib/inet_aton.c, lib/inet_ntoa.c, lib/memcmp.c, lib/pread.c, lib/pwrite.c,
-   lib/setenv.c, lib/seteuid.c, lib/strlcat.c and lib/strlcpy.c are in
-   the public domain.
+   backends/shrinkfile.c, frontends/scanspool.in, lib/alloca.c,
+   lib/concat.c, lib/inet_aton.c, lib/inet_ntoa.c, lib/pread.c,
+   lib/pwrite.c, lib/setenv.c, lib/seteuid.c, lib/strlcat.c and
+   lib/strlcpy.c are in the public domain.
 
    lib/snprintf.c may be used for any purpose as long as the author's
    notice remains intact in all source code distributions.

Modified: 2.6/MANIFEST
===================================================================
--- 2.6/MANIFEST	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/MANIFEST	2018-01-28 21:21:21 UTC (rev 10229)
@@ -521,7 +521,6 @@
 lib/lockfile.c                        Try to lock a file descriptor
 lib/makedir.c                         Make directory recursively
 lib/md5.c                             MD5 checksum calculation
-lib/memcmp.c                          memcmp replacement
 lib/messageid.c                       Functions for message-IDs
 lib/messages.c                        Error reporting and debug output
 lib/mkstemp.c                         mkstemp replacement
@@ -885,6 +884,7 @@
 tests/lib/date-t.c                    Tests for lib/date.c
 tests/lib/dispatch-t.c                Tests for lib/dispatch.c
 tests/lib/fakewrite.c                 Helper functions for xwrite tests
+tests/lib/fakewrite.h                 Header file for xwrite helper functions
 tests/lib/fdflag-t.c                  Tests for lib/fdflag.c
 tests/lib/getaddrinfo-t.c             Tests for lib/getaddrinfo.c
 tests/lib/getnameinfo-t.c             Tests for lib/getnameinfo.c
@@ -898,7 +898,6 @@
 tests/lib/innconf-t.c                 Tests for lib/innconf.c
 tests/lib/list-t.c                    Tests for lib/list.c
 tests/lib/md5-t.c                     Tests for lib/md5.c
-tests/lib/memcmp-t.c                  Tests for lib/memcmp.c
 tests/lib/messageid-t.c               Tests for lib/messageid.c
 tests/lib/messages-t.c                Tests for lib/messages.c
 tests/lib/mkstemp-t.c                 Tests for lib/mkstemp.c

Modified: 2.6/Makefile.global.in
===================================================================
--- 2.6/Makefile.global.in	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/Makefile.global.in	2018-01-28 21:21:21 UTC (rev 10229)
@@ -78,6 +78,7 @@
 ##    -Wredundant-decls     Too much noise from system headers.
 ##    -Wlong-long           Too much noise from system headers.
 ##    -Woverlength-strings  Useless noise.
+##    -Wunused-function     Noise from embedded Perl (at least with Perl 5.20).
 ##
 ##  Some may be worth looking at again once a released version of gcc doesn't
 ##  warn on system headers.  The warnings below are in the same order as
@@ -107,7 +108,7 @@
 		  -Wmissing-prototypes -Wmissing-declarations \
 		  -Wmissing-format-attribute \
 		  -Wnormalized=nfc -Wnested-externs -Winline \
-		  -Winvalid-pch -Wvla
+		  -Winvalid-pch -Wvla -Wno-unused-function
 
 ##  Some warnings have to be suppressed for Perl, since there's no way to work
 ##  around the Perl header problems in INN code.

Modified: 2.6/configure.ac
===================================================================
--- 2.6/configure.ac	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/configure.ac	2018-01-28 21:21:21 UTC (rev 10229)
@@ -618,12 +618,10 @@
 dnl Checks for macros.
 INN_MACRO_IN6_ARE_ADDR_EQUAL
 INN_MACRO_IOV_MAX
-INN_MACRO_SA_LEN
 INN_MACRO_SUN_LEN
 
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
-AC_FUNC_MEMCMP
 INN_FUNC_GETADDRINFO_ADDRCONFIG
 INN_FUNC_INET_NTOA
 INN_FUNC_SNPRINTF

Modified: 2.6/include/clibrary.h
===================================================================
--- 2.6/include/clibrary.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/include/clibrary.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -174,7 +174,8 @@
 #if !HAVE_ASPRINTF
 extern int asprintf(char **, const char *, ...)
     __attribute__((__format__(printf, 2, 3)));
-extern int vasprintf(char **, const char *, va_list);
+extern int vasprintf(char **, const char *, va_list)
+    __attribute__((__format__(printf, 2, 0)));
 #endif
 #if !HAVE_DECL_SNPRINTF
 extern int snprintf(char *, size_t, const char *, ...)
@@ -181,7 +182,8 @@
     __attribute__((__format__(printf, 3, 4)));
 #endif
 #if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
+extern int vsnprintf(char *, size_t, const char *, va_list)
+    __attribute__((__format__(printf, 3, 0)));
 #endif
 #if !HAVE_MKSTEMP
 extern int mkstemp(char *);
@@ -214,9 +216,6 @@
 #if !HAVE_STRTOK
 extern char * strtok(char *, const char *);
 #endif
-#if !HAVE_MEMCMP
-extern int memcmp(const void *, const void *, size_t);
-#endif
 
 END_DECLS
 

Modified: 2.6/include/inn/network.h
===================================================================
--- 2.6/include/inn/network.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/include/inn/network.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,7 +6,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2014, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014, 2016, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2012, 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  * Copyright (c) 2004, 2005, 2006, 2007, 2008, 2010
@@ -158,7 +158,7 @@
  * Put an ASCII representation of the address in a sockaddr into the provided
  * buffer, which should hold at least INET6_ADDRSTRLEN characters.
  */
-bool network_sockaddr_sprint(char *, size_t, const struct sockaddr *)
+bool network_sockaddr_sprint(char *, socklen_t, const struct sockaddr *)
     __attribute__((__nonnull__));
 
 /*

Modified: 2.6/include/inn/xmalloc.h
===================================================================
--- 2.6/include/inn/xmalloc.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/include/inn/xmalloc.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -108,7 +108,7 @@
 
 /* The default error handler. */
 void xmalloc_fail(const char *, size_t, const char *, int)
-    __attribute__((__nonnull__));
+    __attribute__((__nonnull__, __noreturn__));
 
 /*
  * Assign to this variable to choose a handler other than the default, which

Modified: 2.6/include/portable/socket.h
===================================================================
--- 2.6/include/portable/socket.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/include/portable/socket.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -17,7 +17,7 @@
  * The canonical version of this file is maintained in the rra-c-util package,
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
- * Copyright 2014 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2008, 2009, 2011, 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  * Copyright (c) 2004, 2005, 2006, 2007
@@ -127,28 +127,6 @@
     (memcmp((a), (b), sizeof(struct in6_addr)) == 0)
 #endif
 
-/* Define an SA_LEN macro that gives us the length of a sockaddr. */
-#if !HAVE_SA_LEN
-# if HAVE_STRUCT_SOCKADDR_SA_LEN
-#  define SA_LEN(s)     ((s)->sa_len)
-# else
-/* Hack courtesy of the USAGI project. */
-#  if HAVE_INET6
-#   define SA_LEN(s) \
-    ((((const struct sockaddr *)(s))->sa_family == AF_INET6)            \
-        ? sizeof(struct sockaddr_in6)                                   \
-        : ((((const struct sockaddr *)(s))->sa_family == AF_INET)       \
-            ? sizeof(struct sockaddr_in)                                \
-            : sizeof(struct sockaddr)))
-#  else
-#   define SA_LEN(s) \
-    ((((const struct sockaddr *)(s))->sa_family == AF_INET)             \
-        ? sizeof(struct sockaddr_in)                                    \
-        : sizeof(struct sockaddr))
-#  endif
-# endif /* HAVE_SOCKADDR_LEN */
-#endif /* !HAVE_SA_LEN_MACRO */
-
 /*
  * AI_ADDRCONFIG results in an error from getaddrinfo on BSD/OS and possibly
  * other platforms.  If configure determined it didn't work, pretend it

Modified: 2.6/innd/perl.c
===================================================================
--- 2.6/innd/perl.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/innd/perl.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -39,7 +39,9 @@
 #include "innd.h"
 
 #include <EXTERN.h>
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include <perl.h>
+#pragma GCC diagnostic warning "-Wredundant-decls"
 #include <XSUB.h>
 #include "ppport.h"
 

Modified: 2.6/innd/python.c
===================================================================
--- 2.6/innd/python.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/innd/python.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -32,7 +32,9 @@
  *  and before any standard headers are included (because Python may
  *  define some pre-processor definitions which affect the standard
  *  headers on some systems). */
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include "Python.h"
+#pragma GCC diagnostic warning "-Wredundant-decls"
 
 /*  Define Py_ssize_t when it does not exist (Python < 2.5.0). */
 #if PY_VERSION_HEX < 0x02050000

Modified: 2.6/innd/rc.c
===================================================================
--- 2.6/innd/rc.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/innd/rc.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -128,7 +128,7 @@
     struct sockaddr *s_local;
     struct sockaddr *s_distant = NULL;
     int ident_fd;
-    socklen_t len;
+    socklen_t local_len, distant_len;
     int port1,port2;
     ssize_t lu;
     char buf[80], *buf2;
@@ -137,14 +137,14 @@
          return true;
 
     s_local = xmalloc(sizeof(struct sockaddr_storage));
-    len = sizeof(struct sockaddr_storage);
-    if ((getsockname(fd, s_local, &len)) < 0) {
+    local_len = sizeof(struct sockaddr_storage);
+    if ((getsockname(fd, s_local, &local_len)) < 0) {
 	syslog(L_ERROR, "can't do getsockname for identd");
         goto fail;
     }
     s_distant = xmalloc(sizeof(struct sockaddr_storage));
-    len = sizeof(struct sockaddr_storage);
-    if ((getpeername(fd, s_distant, &len)) < 0) {
+    distant_len = sizeof(struct sockaddr_storage);
+    if ((getpeername(fd, s_distant, &distant_len)) < 0) {
 	syslog(L_ERROR, "can't do getpeername for identd");
         goto fail;
     }
@@ -174,12 +174,12 @@
 	syslog(L_ERROR, "can't open socket for identd (%m)");
         goto fail;
     }
-    if (bind(ident_fd, s_local, SA_LEN(s_local)) < 0) {
+    if (bind(ident_fd, s_local, local_len) < 0) {
 	syslog(L_ERROR, "can't bind socket for identd (%m)");
         close(ident_fd);
         goto fail;
     }
-    if (connect(ident_fd, s_distant, SA_LEN(s_distant)) < 0) {
+    if (connect(ident_fd, s_distant, distant_len) < 0) {
 	syslog(L_ERROR, "can't connect to identd (%m)");
         close(ident_fd);
         goto fail;

Modified: 2.6/innfeed/connection.c
===================================================================
--- 2.6/innfeed/connection.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/innfeed/connection.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -490,6 +490,7 @@
 bool cxnConnect (Connection cxn)
 {
   struct sockaddr *cxnAddr;
+  socklen_t len;
   int fd, rval;
   const char *src;
   const char *peerName = hostPeerName (cxn->myHost) ;
@@ -524,9 +525,20 @@
     }
 
   if (cxnAddr->sa_family == AF_INET)
-    src = hostBindAddr(cxn->myHost);
+    {
+      src = hostBindAddr(cxn->myHost) ;
+      len = sizeof(struct sockaddr_in) ;
+    }
   else
-    src = hostBindAddr6(cxn->myHost);
+    {
+      src = hostBindAddr6(cxn->myHost) ;
+#if HAVE_INET6
+      len = sizeof(struct sockaddr_in6) ;
+#else
+      /* This should never happen, but the compiler doesn't know that. */
+      len = sizeof(struct sockaddr) ;
+#endif
+    }
   if (src && strcmp(src, "none") == 0)
     src = NULL;
 
@@ -553,7 +565,7 @@
       return false ;
     }
 
-  rval = connect (fd, cxnAddr, SA_LEN(cxnAddr)) ;
+  rval = connect (fd, cxnAddr, len) ;
   if (rval < 0 && errno != EINPROGRESS)
     {
       syswarn ("%s:%d connect", peerName, cxn->ident) ;

Modified: 2.6/lib/Makefile
===================================================================
--- 2.6/lib/Makefile	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/Makefile	2018-01-28 21:21:21 UTC (rev 10229)
@@ -29,7 +29,7 @@
 # Sources for additional functions only built to replace missing system ones.
 EXTRA_SOURCES = alloca.c asprintf.c fseeko.c ftello.c getaddrinfo.c	   \
 		getnameinfo.c getpagesize.c inet_aton.c inet_ntoa.c	   \
-		inet_ntop.c memcmp.c mkstemp.c pread.c pwrite.c            \
+		inet_ntop.c mkstemp.c pread.c pwrite.c            \
 	        reallocarray.c setenv.c                                    \
 		seteuid.c setproctitle.c snprintf.c strcasecmp.c strlcat.c \
 		strlcpy.c strspn.c strtok.c symlink.c
@@ -591,10 +591,6 @@
   ../include/portable/stdbool.h ../include/portable/socket.h \
   ../include/portable/macros.h ../include/portable/getaddrinfo.h \
   ../include/portable/getnameinfo.h
-memcmp.o: memcmp.c ../include/config.h ../include/inn/defines.h \
-  ../include/inn/system.h ../include/inn/macros.h \
-  ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
-  ../include/inn/defines.h ../include/inn/options.h
 mkstemp.o: mkstemp.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \

Modified: 2.6/lib/getaddrinfo.c
===================================================================
--- 2.6/lib/getaddrinfo.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/getaddrinfo.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -253,7 +253,7 @@
     if (convert_service(servname, &value)) {
         if (value > (1L << 16) - 1)
             return EAI_SERVICE;
-        *port = value;
+        *port = (unsigned short) value;
     } else {
         if (flags & AI_NUMERICSERV)
             return EAI_NONAME;
@@ -276,7 +276,9 @@
             *type = SOCK_STREAM;
         else
             return EAI_SERVICE;
-        *port = htons(servent->s_port);
+        if (servent->s_port > (1L << 16) - 1)
+            return EAI_SERVICE;
+        *port = htons((unsigned short) servent->s_port);
     }
     return 0;
 }

Modified: 2.6/lib/inet_aton.c
===================================================================
--- 2.6/lib/inet_aton.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/inet_aton.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -37,7 +37,8 @@
 int
 inet_aton(const char *s, struct in_addr *addr)
 {
-    unsigned long octet[4], address;
+    unsigned octet[4];
+    uint32_t address;
     const char *p;
     int base, i;
     int part = 0;

Deleted: 2.6/lib/memcmp.c
===================================================================
--- 2.6/lib/memcmp.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/memcmp.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -1,43 +0,0 @@
-/*  $Id$
-**
-**  Replacement for a missing or broken memcmp.
-**
-**  Written by Russ Allbery <eagle at eyrie.org>
-**  This work is hereby placed in the public domain by its author.
-**
-**  Provides the same functionality as the standard library routine memcmp
-**  for those platforms that don't have it or where it doesn't work right
-**  (such as on SunOS where it can't deal with eight-bit characters).
-*/
-
-#include "config.h"
-#include <sys/types.h>
-
-/* If we're running the test suite, rename memcmp to avoid conflicts with
-   the system version. */
-#if TESTING
-# undef memcmp
-# define memcmp test_memcmp
-int test_memcmp(const void *, const void *, size_t);
-#endif
-
-int
-memcmp(const void *s1, const void *s2, size_t n)
-{
-    size_t i;
-    const unsigned char *p1, *p2;
-
-    /* It's technically illegal to call memcmp with NULL pointers, but we
-       may as well check anyway. */
-    if (!s1)
-        return !s2 ? 0 : -1;
-    if (!s2)
-        return 1;
-
-    p1 = (const unsigned char *) s1;
-    p2 = (const unsigned char *) s2;
-    for (i = 0; i < n; i++, p1++, p2++)
-        if (*p1 != *p2)
-	    return (int) *p1 - (int) *p2;
-    return 0;
-}

Modified: 2.6/lib/network.c
===================================================================
--- 2.6/lib/network.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/network.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -21,7 +21,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2014, 2015, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014, 2015, 2016, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2011, 2012, 2013, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  * Copyright (c) 2004, 2005, 2006, 2007, 2008
@@ -824,7 +824,7 @@
  * it should always be as large as the latter.  Returns success or failure.
  */
 bool
-network_sockaddr_sprint(char *dst, size_t size, const struct sockaddr *addr)
+network_sockaddr_sprint(char *dst, socklen_t size, const struct sockaddr *addr)
 {
     const char *result;
 
@@ -944,7 +944,7 @@
     unsigned long cidr;
     char *end;
     unsigned int i;
-    unsigned long bits, addr_mask;
+    uint32_t bits, addr_mask;
 #ifdef HAVE_INET6
     struct in6_addr a6, b6;
 #endif
@@ -971,7 +971,7 @@
             if (cidr > 32 || *end != '\0')
                 return false;
             for (bits = 0, i = 0; i < cidr; i++)
-                bits |= (1UL << (31 - i));
+                bits |= (1U << (31 - i));
             addr_mask = htonl(bits);
         } else if (inet_aton(mask, &tmp))
             addr_mask = tmp.s_addr;
@@ -1000,7 +1000,7 @@
                 return false;
         } else {
             for (addr_mask = 0, bits = 0; bits < cidr % 8; bits++)
-                addr_mask |= (1UL << (7 - bits));
+                addr_mask |= (1U << (7 - bits));
             if ((a6.s6_addr[i] & addr_mask) != (b6.s6_addr[i] & addr_mask))
                 return false;
         }

Modified: 2.6/lib/perl.c
===================================================================
--- 2.6/lib/perl.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/perl.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -23,7 +23,9 @@
 #include "inn/libinn.h"
 
 #include <EXTERN.h>
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include <perl.h>
+#pragma GCC diagnostic warning "-Wredundant-decls"
 #include <XSUB.h>
 #include "ppport.h"
 

Modified: 2.6/lib/snprintf.c
===================================================================
--- 2.6/lib/snprintf.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/lib/snprintf.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -26,6 +26,11 @@
 # define vsnprintf test_vsnprintf
 #endif
 
+/* Specific to rra-c-util, but only when debugging is enabled. */
+#ifdef DEBUG_SNPRINTF
+# include "inn/messages.h"
+#endif
+
 /*
  * Copyright Patrick Powell 1995
  * This code is based on code written by Patrick Powell (papowell at astart.com)
@@ -81,12 +86,24 @@
  *    fixed return value to comply with C99
  *    fixed handling of snprintf(NULL, ...)
  *    added explicit casts for double to long long int conversion
+ *    fixed various warnings with GCC 7
+ *    fixed various warnings with Clang
  *
- *  Hrvoje Niksic <hniksic at arsdigita.com> 2000-11-04
+ *  Hrvoje Niksic <hniksic at xemacs.org> 2000-11-04
+ *    include <config.h> instead of "config.h".
+ *    moved TEST_SNPRINTF stuff out of HAVE_SNPRINTF ifdef.
  *    include <stdio.h> for NULL.
- *    added support for long long.
+ *    added support and test cases for long long.
  *    don't declare argument types to (v)snprintf if stdarg is not used.
+ *    use int instead of short int as 2nd arg to va_arg.
  *
+ *  alexk (INN) 2002-08-21
+ *    use LLONG in fmtfp to handle more characters during floating
+ *    point conversion.
+ *
+ *  herb (Samba) 2002-12-19
+ *    actually print args for %g and %e
+ *
  *  Hrvoje Niksic <hniksic at xemacs.org> 2005-04-15
  *    use the PARAMS macro to handle prototypes.
  *    write function definitions in the ansi2knr-friendly way.
@@ -111,11 +128,6 @@
 /* varargs declarations: */
 
 #include <stdarg.h>
-#define HAVE_STDARGS    /* let's hope that works everywhere (mj) */
-#define VA_LOCAL_DECL   va_list ap
-#define VA_START(f)     va_start(ap, f)
-#define VA_SHIFT(v,t)  ;   /* no-op for ANSI */
-#define VA_END          va_end(ap)
 
 /* Assume all compilers support long double, per Autoconf documentation. */
 #define LDOUBLE long double
@@ -353,6 +365,7 @@
 	break;
       case 'X':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'x':
 	flags |= DP_F_UNSIGNED;
 	if (cflags == DP_C_SHORT)
@@ -369,26 +382,28 @@
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);
 	else
-	  fvalue = va_arg (args, double);
+	  fvalue = (LDOUBLE) va_arg (args, double);
 	total += fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
 	break;
       case 'E':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'e':
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);
 	else
-	  fvalue = va_arg (args, double);
+	  fvalue = (LDOUBLE) va_arg (args, double);
         total += fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
 	break;
       case 'G':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'g':
         flags |= DP_F_FP_G;
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);
 	else
-	  fvalue = va_arg (args, double);
+	  fvalue = (LDOUBLE) va_arg (args, double);
 	if (max == 0)
 	  /* C99 says: if precision [for %g] is zero, it is taken as one */
 	  max = 1;
@@ -395,7 +410,8 @@
 	total += fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
 	break;
       case 'c':
-	total += dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
+	total += dopr_outch (buffer, &currlen, maxlen,
+			     (char) va_arg (args, int));
 	break;
       case 's':
 	strvalue = va_arg (args, char *);
@@ -411,7 +427,7 @@
 	{
 	  short int *num;
 	  num = va_arg (args, short int *);
-	  *num = currlen;
+	  *num = (short) currlen;
         } 
 	else if (cflags == DP_C_LONG) 
 	{
@@ -429,7 +445,7 @@
 	{
 	  int *num;
 	  num = va_arg (args, int *);
-	  *num = currlen;
+	  *num = (int) currlen;
         }
 	break;
       case '%':
@@ -478,7 +494,7 @@
   }
 
   if (max < 0)
-    strln = strlen (value);
+    strln = (int) strlen (value);
   else
     /* When precision is specified, don't read VALUE past precision. */
     /*strln = strnlen (value, max);*/
@@ -512,7 +528,7 @@
 static int fmtint (char *buffer, size_t *currlen, size_t maxlen,
 		   LLONG value, int base, int min, int max, int flags)
 {
-  int signvalue = 0;
+  char signvalue = 0;
   unsigned LLONG uvalue;
   char convert[24];
   unsigned int place = 0;
@@ -566,8 +582,8 @@
     spadlen = -spadlen; /* Left Justifty */
 
 #ifdef DEBUG_SNPRINTF
-  dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
-      zpadlen, spadlen, min, max, place));
+  debug ("zpad: %d, spad: %d, min: %d, max: %d, place: %u\n",
+         zpadlen, spadlen, min, max, place);
 #endif
 
   /* Spaces */
@@ -614,7 +630,7 @@
   return result;
 }
 
-static LLONG pow10_int (int exp)
+static LLONG pow10_int (unsigned int exp)
 {
   LDOUBLE result = 1;
 
@@ -633,23 +649,31 @@
 
   intpart = (LLONG) value;
   value = value - intpart;
-  if (value >= 0.5)
+  if (value >= (LDOUBLE) 0.5)
     intpart++;
 
   return intpart;
 }
 
+/*
+ * GCC 7.1 issues this warning at the point of the function definition header
+ * (not in any actual code), and I can't figure out what's triggering it since
+ * the comparison form doesn't appear anywhere in this code.  Since this is
+ * rarely-used portability code, suppress the warning.
+ */
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+
 static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
 		  LDOUBLE fvalue, int min, int max, int flags)
 {
-  int signvalue = 0;
+  char signvalue = 0;
   LDOUBLE ufvalue;
   char iconvert[24];
   char fconvert[24];
   size_t iplace = 0;
   size_t fplace = 0;
-  int padlen = 0; /* amount to pad */
-  int zpadlen = 0; 
+  long padlen = 0; /* amount to pad */
+  long zpadlen = 0; 
   int total = 0;
   LLONG intpart;
   LLONG fracpart;
@@ -701,7 +725,7 @@
 	     fractional digit. */
 	  LDOUBLE temp;
 	  if (ufvalue > 0)
-	    for (temp = ufvalue; temp < 0.1; temp *= 10)
+	    for (temp = ufvalue; temp < (LDOUBLE) 0.1; temp *= 10)
 	      ++max;
 	}
     }
@@ -748,12 +772,16 @@
       }
 
 #ifdef DEBUG_SNPRINTF
-  dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
+# ifdef HAVE_LONG_LONG_INT
+  debug ("fmtfp: %Lf =? %lld.%lld\n", fvalue, intpart, fracpart);
+# else
+  debug ("fmtfp: %Lf =? %ld.%ld\n", fvalue, intpart, fracpart);
+# endif
 #endif
 
   /* Convert integer part */
   do {
-    iconvert[iplace++] = '0' + intpart % 10;
+    iconvert[iplace++] = (char) ('0' + (intpart % 10));
     intpart = (intpart / 10);
   } while(intpart && (iplace < sizeof(iconvert)));
   if (iplace == sizeof(iconvert)) iplace--;
@@ -761,7 +789,7 @@
 
   /* Convert fractional part */
   do {
-    fconvert[fplace++] = '0' + fracpart % 10;
+    fconvert[fplace++] = (char) ('0' + (fracpart % 10));
     fracpart = (fracpart / 10);
   } while(fracpart && (fplace < sizeof(fconvert)));
   while (leadingfrac0s-- > 0 && fplace < sizeof(fconvert))
@@ -849,27 +877,14 @@
   return dopr(str, count, fmt, args);
 }
 
-/* VARARGS3 */
-#ifdef HAVE_STDARGS
-int snprintf (char *str,size_t count,const char *fmt,...)
-#else
-int snprintf (va_alist) va_dcl
-#endif
+int snprintf (char *str, size_t count, const char *fmt,...)
 {
-#ifndef HAVE_STDARGS
-  char *str;
-  size_t count;
-  char *fmt;
-#endif
-  VA_LOCAL_DECL;
+  va_list ap;
   int total;
     
-  VA_START (fmt);
-  VA_SHIFT (str, char *);
-  VA_SHIFT (count, size_t );
-  VA_SHIFT (fmt, char *);
+  va_start(ap, fmt);
   total = vsnprintf(str, count, fmt, ap);
-  VA_END;
+  va_end(ap);
   return total;
 }
 
@@ -946,5 +961,6 @@
       num++;
     }
   printf ("%d tests failed out of %d.\n", fail, num);
+  return 0;
 }
-#endif /* SNPRINTF_TEST */
+#endif /* TEST_SNPRINTF */

Modified: 2.6/m4/cc-flags.m4
===================================================================
--- 2.6/m4/cc-flags.m4	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/m4/cc-flags.m4	2018-01-28 21:21:21 UTC (rev 10229)
@@ -8,7 +8,7 @@
 dnl The canonical version of this file is maintained in the rra-c-util
 dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
 dnl
-dnl Copyright 2016 Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2016, 2017 Russ Allbery <eagle at eyrie.org>
 dnl Copyright 2006, 2009, 2016
 dnl     by Internet Systems Consortium, Inc. ("ISC")
 dnl
@@ -26,7 +26,7 @@
 
 dnl Used to build the result cache name.
 AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
-[translit([inn_cv_compiler_c_$1], [-=], [__])])
+[translit([inn_cv_compiler_c_$1], [-=+], [___])])
 
 dnl Check whether a given flag is supported by the complier.
 AC_DEFUN([INN_PROG_CC_FLAG],

Modified: 2.6/m4/socket.m4
===================================================================
--- 2.6/m4/socket.m4	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/m4/socket.m4	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,7 +6,6 @@
 dnl
 dnl     INN_FUNC_GETADDRINFO_ADDRCONFIG
 dnl     INN_MACRO_IN6_ARE_ADDR_EQUAL
-dnl     INN_MACRO_SA_LEN
 dnl
 dnl They use a separate internal source macro to make the code easier to read.
 dnl
@@ -13,6 +12,7 @@
 dnl The canonical version of this file is maintained in the rra-c-util
 dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
 dnl
+dnl Copyright 2017 Russ Allbery <eagle at eyrie.org>
 dnl Copyright 2008, 2009, 2011
 dnl     The Board of Trustees of the Leland Stanford Junior University
 dnl Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009
@@ -99,27 +99,3 @@
  AS_IF([test x"$inn_cv_in6_are_addr_equal_broken" = xyes],
     [AC_DEFINE([HAVE_BROKEN_IN6_ARE_ADDR_EQUAL], 1,
         [Define if your IN6_ARE_ADDR_EQUAL macro is broken.])])])
-
-dnl Source used by INN_MACRO_SA_LEN.
-AC_DEFUN([_INN_MACRO_SA_LEN_SOURCE], [[
-#include <sys/types.h>
-#include <sys/socket.h>
-
-int
-main(void)
-{
-    struct sockaddr sa;
-    int x = SA_LEN(&sa);
-}
-]])
-
-dnl Check whether the SA_LEN macro is available.  This should give the length
-dnl of a struct sockaddr regardless of type.
-AC_DEFUN([INN_MACRO_SA_LEN],
-[AC_CACHE_CHECK([for SA_LEN macro], [inn_cv_sa_len_macro],
-    [AC_LINK_IFELSE([AC_LANG_SOURCE([_INN_MACRO_SA_LEN_SOURCE])],
-        [inn_cv_sa_len_macro=yes],
-        [inn_cv_sa_len_macro=no])])
- AS_IF([test x"$inn_cv_sa_len_macro" = xyes],
-    [AC_DEFINE([HAVE_SA_LEN], 1,
-        [Define if <sys/socket.h> defines the SA_LEN macro.])])])

Modified: 2.6/nnrpd/nnrpd.c
===================================================================
--- 2.6/nnrpd/nnrpd.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/nnrpd/nnrpd.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -531,7 +531,7 @@
 **  since anyone can fake reverse DNS entries.
 */
 static bool
-Address2Name(struct sockaddr *sa, char *hostname, size_t size)
+Address2Name(struct sockaddr *sa, socklen_t len, char *hostname, size_t size)
 {
     static const char MISMATCH[] = "reverse lookup validation failed";
     struct addrinfo hints, *ai, *host;
@@ -540,7 +540,7 @@
     bool valid = false;
 
     /* Get the official hostname, store it away. */
-    ret = getnameinfo(sa, SA_LEN(sa), hostname, size, NULL, 0, NI_NAMEREQD);
+    ret = getnameinfo(sa, len, hostname, size, NULL, 0, NI_NAMEREQD);
     if (ret != 0) {
 	HostErrorStr = gai_strerror(ret);
 	return false;
@@ -613,7 +613,7 @@
 	}
 	if (GetHostByAddr) {
             HostErrorStr = default_host_error;
-            if (!Address2Name(sac, Client.host, sizeof(Client.host))) {
+            if (!Address2Name(sac, length, Client.host, sizeof(Client.host))) {
                 notice("? reverse lookup for %s failed: %s -- using IP"
                        " address for access", Client.ip, HostErrorStr);
 	        strlcpy(Client.host, Client.ip, sizeof(Client.host));
@@ -641,7 +641,7 @@
 	if (GetHostByAddr) {
 	    HostErrorStr = default_host_error;
             size = sizeof(Client.serverhost);
-            if (!Address2Name(sas, Client.serverhost, size)) {
+            if (!Address2Name(sas, length, Client.serverhost, size)) {
                 notice("? reverse lookup for %s failed: %s -- using IP"
                        " address for access", Client.serverip, HostErrorStr);
 	        strlcpy(Client.serverhost, Client.serverip,

Modified: 2.6/nnrpd/nnrpd.h
===================================================================
--- 2.6/nnrpd/nnrpd.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/nnrpd/nnrpd.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -230,7 +230,6 @@
 extern void		InitBackoffConstants(void);
 extern char		*PostRecFilename(char *ip, char *user);
 extern int		LockPostRec(char *path);
-extern int		LockPostRec(char *path);
 extern void		UnlockPostRec(char *path);
 extern int		RateLimit(long *sleeptime, char *path);
 extern void		ExitWithStats(int x, bool readconf)

Modified: 2.6/nnrpd/perl.c
===================================================================
--- 2.6/nnrpd/perl.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/nnrpd/perl.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -26,7 +26,9 @@
 #ifdef DO_PERL
 
 #include <EXTERN.h>
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include <perl.h>
+#pragma GCC diagnostic warning "-Wredundant-decls"
 #include <XSUB.h>
 #include "ppport.h"
 
@@ -33,7 +35,6 @@
 #include "innperl.h"
 
 extern HEADER Table[], *EndOfTable;
-extern char PERMuser[];
 
 extern char **OtherHeaders;
 extern int OtherCount;

Modified: 2.6/nnrpd/python.c
===================================================================
--- 2.6/nnrpd/python.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/nnrpd/python.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -33,7 +33,9 @@
  *  and before any standard headers are included (because Python may
  *  define some pre-processor definitions which affect the standard
  *  headers on some systems). */
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include "Python.h"
+#pragma GCC diagnostic warning "-Wredundant-decls"
 
 /*  Define Py_ssize_t when it does not exist (Python < 2.5.0). */
 #if PY_VERSION_HEX < 0x02050000

Modified: 2.6/support/getc-tap-harness
===================================================================
--- 2.6/support/getc-tap-harness	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/support/getc-tap-harness	2018-01-28 21:21:21 UTC (rev 10229)
@@ -73,7 +73,7 @@
     # Specific additions to a few files.
     if [ "$3" = "basic.c" ]
     then
-      sed -i -e "56 i \\
+      sed -i -e "58 i \\
 /* Specific to the integration of C TAP Harness in INN. */\\
 #ifndef LIBTEST_NEW_FORMAT\\
 # include \"inn/libinn.h\"\\
@@ -93,7 +93,13 @@
 void\\
 skip(int n UNUSED, const char *reason)\\
 {\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#endif\\
     new_skip(reason, NULL);\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#endif\\
 }\\
 \\
 void\\
@@ -105,7 +111,13 @@
 void\\
 skip_block(int n UNUSED, int count, const char *reason)\\
 {\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#endif\\
     new_skip_block(count, reason, NULL);\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#endif\\
 }\\
 \\
 void\\
@@ -121,9 +133,9 @@
 }\\
 #endif\\
 " \
-             -e "151 i \\
+             -e "152 i \\
 #ifndef INN_LIBINN_H" \
-             -e "185 i \\
+             -e "186 i \\
 #endif" \
              -e 's/^ok.int /new_ok(int /g' \
              -e 's/^skip.const /new_skip(const /g' \
@@ -134,7 +146,7 @@
 
     if [ "$3" = "basic.h" ]
     then
-      sed -i -e "75 i \\
+      sed -i -e "77 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void ok(int n, int success);\\
@@ -160,7 +172,7 @@
 # define skip new_skip\\
 # define ok_block new_ok_block\\
 # define skip_block new_skip_block" \
-             -e "90 i \\
+             -e "92 i \\
 #endif" \
              ${TEMP}
     fi
@@ -167,7 +179,7 @@
 
     if [ "$3" = "float.c" ]
     then
-      sed -i -e "50 i \\
+      sed -i -e "52 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void\\
@@ -182,7 +194,7 @@
 
     if [ "$3" = "float.h" ]
     then
-      sed -i -e "37 i \\
+      sed -i -e "39 i \\
 #ifndef LIBTEST_NEW_FORMAT\\
 /* Specific to the integration of C TAP Harness in INN. */\\
 void ok_double(int n, double wanted, double seen);\\

Modified: 2.6/support/getrra-c-util
===================================================================
--- 2.6/support/getrra-c-util	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/support/getrra-c-util	2018-01-28 21:21:21 UTC (rev 10229)
@@ -161,7 +161,7 @@
 extern int symlink(const char *, const char *);\\
 #endif\\
 " \
-               -e "154 i \\
+               -e "156 i \\
 #if !HAVE_DECL_STRLCAT\\
 extern size_t strlcat(char *, const char *, size_t);\\
 #endif\\
@@ -180,9 +180,6 @@
 #endif\\
 #if !HAVE_STRTOK\\
 extern char * strtok(char *, const char *);\\
-#endif\\
-#if !HAVE_MEMCMP\\
-extern int memcmp(const void *, const void *, size_t);\\
 #endif" \
                -e '/#if !HAVE_DAEMON/,+2d' \
                -e '/#if !HAVE_ISSETUGID/,+2d' \
@@ -193,11 +190,12 @@
         sed -i -e 's/UTIL_/INN_/g' \
                -e '/^\/\* Default to a hidden visibility for all .* functions\. \*\/$/,+2d' \
                -e '/^\/\* Undo default visibility change\. \*\/$/,+2d' \
-               -e 's/<config\.h>/"config.h"/g' \
+               -e 's/<config\.h>$/"config.h"/g' \
                -e 's/<portable\/system\.h>/"clibrary.h"/g' \
                -e 's/<util\/\(.*\)>/"inn\/\1"/g' \
                -e 's/<portable\/\(.*\)>/"portable\/\1"/g' \
                -e 's/<tests\/tap\/\(.*\)>/"tap\/\1"/g' \
+               -e 's/<tests\/util\/\(.*\)>/"lib\/\1"/g' \
                -e '1 s/$/ \$Id\$\n */' \
                ${TEMP}
 
@@ -306,6 +304,7 @@
 ##  Synchronize test suite files for utility functions from upstream.
 download tests/util/buffer-t.c tests/lib buffer-t.c
 download tests/util/fakewrite.c tests/lib fakewrite.c
+download tests/util/fakewrite.h tests/lib fakewrite.h
 download tests/util/fdflag-t.c tests/lib fdflag-t.c
 download tests/util/messages-t.c tests/lib messages-t.c
 download tests/util/vector-t.c tests/lib vector-t.c

Modified: 2.6/support/mkmanifest
===================================================================
--- 2.6/support/mkmanifest	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/support/mkmanifest	2018-01-28 21:21:21 UTC (rev 10229)
@@ -152,6 +152,7 @@
 frontends/ctlinnd
 frontends/decode
 frontends/encode
+frontends/feedone
 frontends/getlist
 frontends/gunbatch
 frontends/inews
@@ -165,6 +166,7 @@
 frontends/rnews
 frontends/scanspool
 frontends/sm
+frontends/sys2nf
 history/buildconfig
 include/config.h
 include/inn/paths.h
@@ -287,7 +289,6 @@
 tests/lib/innconf.t
 tests/lib/list.t
 tests/lib/md5.t
-tests/lib/memcmp.t
 tests/lib/messageid.t
 tests/lib/messages.t
 tests/lib/mkstemp.t

Modified: 2.6/tests/Makefile
===================================================================
--- 2.6/tests/Makefile	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/Makefile	2018-01-28 21:21:21 UTC (rev 10229)
@@ -21,7 +21,7 @@
 	lib/getaddrinfo.t lib/getnameinfo.t lib/hash.t \
 	lib/hashtab.t lib/headers.t lib/hex.t lib/inet_aton.t \
 	lib/inet_ntoa.t lib/inet_ntop.t lib/innconf.t lib/list.t lib/md5.t \
-	lib/memcmp.t lib/messageid.t lib/messages.t lib/mkstemp.t \
+	lib/messageid.t lib/messages.t lib/mkstemp.t \
 	lib/network/addr-ipv4.t lib/network/addr-ipv6.t \
 	lib/network/client.t lib/network/server.t \
 	lib/pread.t lib/pwrite.t lib/qio.t lib/reallocarray.t \
@@ -167,12 +167,6 @@
 lib/md5.t: lib/md5-t.o tap/basic.o $(LIBINN)
 	$(LINK) lib/md5-t.o tap/basic.o $(LIBINN)
 
-lib/memcmp.o: ../lib/memcmp.c
-	$(CC) $(CFLAGS) -DTESTING -c -o $@ ../lib/memcmp.c
-
-lib/memcmp.t: lib/memcmp.o lib/memcmp-t.o tap/basic.o $(LIBINN)
-	$(LINK) lib/memcmp.o lib/memcmp-t.o tap/basic.o $(LIBINN)
-
 lib/messageid.t: lib/messageid-t.o tap/basic.o $(LIBINN)
 	$(LINK) lib/messageid-t.o tap/basic.o $(LIBINN)
 

Modified: 2.6/tests/README
===================================================================
--- 2.6/tests/README	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/README	2018-01-28 21:21:21 UTC (rev 10229)
@@ -248,3 +248,5 @@
     are permitted in any medium without royalty provided the copyright
     notice and this notice are preserved.  This file is offered as-is,
     without any warranty.
+
+    SPDX-License-Identifier: FSFAP

Modified: 2.6/tests/TESTS
===================================================================
--- 2.6/tests/TESTS	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/TESTS	2018-01-28 21:21:21 UTC (rev 10229)
@@ -25,7 +25,6 @@
 lib/innconf
 lib/list
 lib/md5
-lib/memcmp
 lib/messageid
 lib/messages
 lib/mkstemp

Modified: 2.6/tests/docs/pod.t
===================================================================
--- 2.6/tests/docs/pod.t	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/docs/pod.t	2018-01-28 21:21:21 UTC (rev 10229)
@@ -7,7 +7,7 @@
 # This file is part of C TAP Harness.  The current version plus supporting
 # documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
 #
-# Copyright 2009, 2010, 2013, 2014, 2015, 2016 Russ Allbery <eagle at eyrie.org>
+# Copyright 2009-2010, 2013-2016 Russ Allbery <eagle at eyrie.org>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,8 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
 
 use 5.006;
 use strict;

Index: branches/2.6/tests/lib
===================================================================
--- 2.6/tests/lib	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib	2018-01-28 21:21:21 UTC (rev 10229)

Property changes on: branches/2.6/tests/lib
___________________________________________________________________
Modified: svn:ignore
## -21,7 +21,6 ##
 innconf.t
 list.t
 md5.t
-memcmp.t
 messageid.t
 messages.t
 mkstemp.t
Modified: 2.6/tests/lib/asprintf-t.c
===================================================================
--- 2.6/tests/lib/asprintf-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/asprintf-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -26,9 +26,10 @@
 
 int test_asprintf(char **, const char *, ...)
     __attribute__((__format__(printf, 2, 3)));
-int test_vasprintf(char **, const char *, va_list);
+int test_vasprintf(char **, const char *, va_list)
+    __attribute__((__format__(printf, 2, 0)));
 
-static int
+static int __attribute__((__format__(printf, 2, 3)))
 vatest(char **result, const char *format, ...)
 {
     va_list args;

Modified: 2.6/tests/lib/fakewrite.c
===================================================================
--- 2.6/tests/lib/fakewrite.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/fakewrite.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -5,7 +5,7 @@
  * The canonical version of this file is maintained in the rra-c-util package,
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
- * Copyright 2000, 2001, 2002, 2004 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000, 2001, 2002, 2004, 2017 Russ Allbery <eagle at eyrie.org>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -35,10 +35,8 @@
 #include <errno.h>
 
 #include "inn/macros.h"
+#include "lib/fakewrite.h"
 
-ssize_t fake_write(int, const void *, size_t);
-ssize_t fake_pwrite(int, const void *, size_t, off_t);
-ssize_t fake_writev(int, const struct iovec *, int);
 
 /*
  * All the data is actually written into this buffer.  We use write_offset
@@ -51,13 +49,13 @@
  * If write_interrupt is non-zero, then half of the calls to write or writev
  * will fail, returning -1 with errno set to EINTR.
  */
-int write_interrupt = 0;
+int write_interrupt = false;
 
 /*
- * If write_fail is non-zero, all writes or writevs will return 0, indicating
- * no progress in writing out the buffer.
+ * If write_fail is true, all writes or writevs will return 0, indicating no
+ * progress in writing out the buffer.
  */
-int write_fail = 0;
+bool write_fail = false;
 
 
 /*
@@ -119,8 +117,8 @@
 ssize_t
 fake_writev(int fd UNUSED, const struct iovec *iov, int iovcnt)
 {
-    int total, i;
-    size_t left, n;
+    int i;
+    size_t left, n, total;
 
     if (write_fail)
         return 0;

Copied: branches/2.6/tests/lib/fakewrite.h (from rev 10201, trunk/tests/lib/fakewrite.h)
===================================================================
--- 2.6/tests/lib/fakewrite.h	                        (rev 0)
+++ 2.6/tests/lib/fakewrite.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -0,0 +1,59 @@
+/* $Id$
+ *
+ * Testing interface to fake write functions.
+ *
+ * This header defines the interfaces to fake write functions used to test
+ * error handling wrappers around system write functions.
+ *
+ * Copyright 2000, 2001, 2002, 2004, 2017 Russ Allbery <eagle at eyrie.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#define LIBTEST_NEW_FORMAT 1
+
+#ifndef TESTS_INN_FAKEWRITE_H
+#define TESTS_INN_FAKEWRITE_H 1
+
+#include "config.h"
+#include "portable/macros.h"
+#include "portable/stdbool.h"
+
+#include <sys/types.h>
+
+BEGIN_DECLS
+
+/* Replacement functions called instead of C library calls. */
+extern ssize_t fake_write(int, const void *, size_t);
+extern ssize_t fake_pwrite(int, const void *, size_t, off_t);
+extern ssize_t fake_writev(int, const struct iovec *, int);
+
+/* The data written and how many bytes have been written. */
+extern char write_buffer[256];
+extern size_t write_offset;
+
+/* If true, half the calls to write or writev will fail with EINTR. */
+extern int write_interrupt;
+
+/* If true, all write or writev calls will return 0. */
+extern bool write_fail;
+
+END_DECLS
+
+#endif /* !TESTS_INN_FAKEWRITE_H */

Modified: 2.6/tests/lib/inet_aton-t.c
===================================================================
--- 2.6/tests/lib/inet_aton-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/inet_aton-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -28,7 +28,7 @@
 
 
 static void
-test_addr(const char *string, unsigned long addr)
+test_addr(const char *string, uint32_t addr)
 {
     int success;
     struct in_addr in;
@@ -58,32 +58,32 @@
     plan(92);
 
     test_addr(            "0.0.0.0", 0);
-    test_addr(     "127.0.0.000000", 0x7f000000UL);
-    test_addr(    "255.255.255.255", 0xffffffffUL);
-    test_addr(    "172.200.232.199", 0xacc8e8c7UL);
-    test_addr(            "1.2.3.4", 0x01020304UL);
+    test_addr(     "127.0.0.000000", 0x7f000000U);
+    test_addr(    "255.255.255.255", 0xffffffffU);
+    test_addr(    "172.200.232.199", 0xacc8e8c7U);
+    test_addr(            "1.2.3.4", 0x01020304U);
 
     test_addr(    "0x0.0x0.0x0.0x0", 0);
-    test_addr("0x7f.0x000.0x0.0x00", 0x7f000000UL);
-    test_addr("0xff.0xFf.0xFF.0xff", 0xffffffffUL);
-    test_addr("0xAC.0xc8.0xe8.0xC7", 0xacc8e8c7UL);
-    test_addr("0xAa.0xbB.0xCc.0xdD", 0xaabbccddUL);
-    test_addr("0xEe.0xfF.0.0x00000", 0xeeff0000UL);
-    test_addr("0x1.0x2.0x00003.0x4", 0x01020304UL);
+    test_addr("0x7f.0x000.0x0.0x00", 0x7f000000U);
+    test_addr("0xff.0xFf.0xFF.0xff", 0xffffffffU);
+    test_addr("0xAC.0xc8.0xe8.0xC7", 0xacc8e8c7U);
+    test_addr("0xAa.0xbB.0xCc.0xdD", 0xaabbccddU);
+    test_addr("0xEe.0xfF.0.0x00000", 0xeeff0000U);
+    test_addr("0x1.0x2.0x00003.0x4", 0x01020304U);
 
     test_addr(   "000000.00.000.00", 0);
-    test_addr(             "0177.0", 0x7f000000UL);
-    test_addr("0377.0377.0377.0377", 0xffffffffUL);
-    test_addr("0254.0310.0350.0307", 0xacc8e8c7UL);
-    test_addr("00001.02.3.00000004", 0x01020304UL);
+    test_addr(             "0177.0", 0x7f000000U);
+    test_addr("0377.0377.0377.0377", 0xffffffffU);
+    test_addr("0254.0310.0350.0307", 0xacc8e8c7U);
+    test_addr("00001.02.3.00000004", 0x01020304U);
 
-    test_addr(           "16909060", 0x01020304UL);
-    test_addr(      "172.062164307", 0xacc8e8c7UL);
-    test_addr(    "172.0xc8.0xe8c7", 0xacc8e8c7UL);
-    test_addr(              "127.1", 0x7f000001UL);
-    test_addr(         "0xffffffff", 0xffffffffUL);
-    test_addr(       "127.0xffffff", 0x7fffffffUL);
-    test_addr(     "127.127.0xffff", 0x7f7fffffUL);
+    test_addr(           "16909060", 0x01020304U);
+    test_addr(      "172.062164307", 0xacc8e8c7U);
+    test_addr(    "172.0xc8.0xe8c7", 0xacc8e8c7U);
+    test_addr(              "127.1", 0x7f000001U);
+    test_addr(         "0xffffffff", 0xffffffffU);
+    test_addr(       "127.0xffffff", 0x7fffffffU);
+    test_addr(     "127.127.0xffff", 0x7f7fffffU);
 
     test_fail(                 "");
     test_fail(     "Donald Duck!");

Modified: 2.6/tests/lib/inet_ntoa-t.c
===================================================================
--- 2.6/tests/lib/inet_ntoa-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/inet_ntoa-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -28,7 +28,7 @@
 
 
 static void
-test_addr(const char *expected, unsigned long addr)
+test_addr(const char *expected, uint32_t addr)
 {
     struct in_addr in;
 
@@ -43,10 +43,10 @@
     plan(5);
 
     test_addr(        "0.0.0.0", 0x0);
-    test_addr(      "127.0.0.0", 0x7f000000UL);
-    test_addr("255.255.255.255", 0xffffffffUL);
-    test_addr("172.200.232.199", 0xacc8e8c7UL);
-    test_addr(        "1.2.3.4", 0x01020304UL);
+    test_addr(      "127.0.0.0", 0x7f000000U);
+    test_addr("255.255.255.255", 0xffffffffU);
+    test_addr("172.200.232.199", 0xacc8e8c7U);
+    test_addr(        "1.2.3.4", 0x01020304U);
 
     return 0;
 }

Modified: 2.6/tests/lib/inet_ntop-t.c
===================================================================
--- 2.6/tests/lib/inet_ntop-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/inet_ntop-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -35,7 +35,7 @@
 
 
 static void
-test_addr(const char *expected, unsigned long addr)
+test_addr(const char *expected, uint32_t addr)
 {
     struct in_addr in;
     char result[INET_ADDRSTRLEN];
@@ -42,7 +42,7 @@
 
     in.s_addr = htonl(addr);
     if (test_inet_ntop(AF_INET, &in, result, sizeof(result)) == NULL) {
-        printf("# cannot convert %lu: %s", addr, strerror(errno));
+        printf("# cannot convert %u: %s", addr, strerror(errno));
         ok(0, "converting %s", expected);
     } else
         ok(1, "converting %s", expected);
@@ -63,10 +63,10 @@
     is_int(ENOSPC, errno, "...with right errno");
 
     test_addr(        "0.0.0.0", 0x0);
-    test_addr(      "127.0.0.0", 0x7f000000UL);
-    test_addr("255.255.255.255", 0xffffffffUL);
-    test_addr("172.200.232.199", 0xacc8e8c7UL);
-    test_addr(        "1.2.3.4", 0x01020304UL);
+    test_addr(      "127.0.0.0", 0x7f000000U);
+    test_addr("255.255.255.255", 0xffffffffU);
+    test_addr("172.200.232.199", 0xacc8e8c7U);
+    test_addr(        "1.2.3.4", 0x01020304U);
 
     return 0;
 }

Deleted: 2.6/tests/lib/memcmp-t.c
===================================================================
--- 2.6/tests/lib/memcmp-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/memcmp-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -1,34 +0,0 @@
-/* $Id$ */
-/* memcmp test suite. */
-
-#include "config.h"
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "tap/basic.h"
-
-int test_memcmp(const void *, const void *, size_t);
-
-int
-main(void)
-{
-    test_init(15);
-
-    ok( 1, test_memcmp("",             "",             0) == 0);
-    ok( 2, test_memcmp("",             "",             1) == 0);
-    ok( 3, test_memcmp("alpha",        "alpha",        6) == 0);
-    ok( 4, test_memcmp("alpha",        "beta",         5)  < 0);
-    ok( 5, test_memcmp("beta",         "alpha",        5)  > 0);
-    ok( 6, test_memcmp("alpha",        "apple",        1) == 0);
-    ok( 7, test_memcmp("alpha",        "apple",        2)  < 0);
-    ok( 8, test_memcmp("\0v",          "\0w",          2)  < 0);
-    ok( 9, test_memcmp("\200\201\202", "\200\201\202", 4) == 0);
-    ok(10, test_memcmp("\200\201\202", "\200\201\203", 4)  < 0);
-    ok(11, test_memcmp("\200\201\203", "\200\201\202", 4)  > 0);
-    ok(12, test_memcmp("al\0po",       "al\0pha",      6)  > 0);
-    ok(13, test_memcmp("\100",         "\201",         1)  < 0);
-    ok(14, test_memcmp("\200",         "\201",         1)  < 0);
-    ok(15, test_memcmp("a",            "b",            0) == 0);
-
-    return 0;
-}

Modified: 2.6/tests/lib/messages-t.c
===================================================================
--- 2.6/tests/lib/messages-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/messages-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,7 +6,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2002, 2004, 2005, 2015 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2002, 2004, 2005, 2015, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2012
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -49,45 +49,87 @@
 /*
  * Test functions.
  */
-static void test1(void *data UNUSED) { warn("warning"); }
-static void test2(void *data UNUSED) { die("fatal"); }
-static void test3(void *data UNUSED) { errno = EPERM; syswarn("permissions"); }
-static void test4(void *data UNUSED) {
+static void
+test1(void *data UNUSED)
+{
+    warn("warning");
+}
+
+static void __attribute__((__noreturn__))
+test2(void *data UNUSED)
+{
+    die("fatal");
+}
+
+static void
+test3(void *data UNUSED)
+{
+    errno = EPERM;
+    syswarn("permissions");
+}
+
+static void __attribute__((__noreturn__))
+test4(void *data UNUSED)
+{
     errno = EACCES;
     sysdie("fatal access");
 }
-static void test5(void *data UNUSED) {
+
+static void
+test5(void *data UNUSED)
+{
     message_program_name = "test5";
     warn("warning");
 }
-static void test6(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test6(void *data UNUSED)
+{
     message_program_name = "test6";
     die("fatal");
 }
-static void test7(void *data UNUSED) {
+
+static void
+test7(void *data UNUSED)
+{
     message_program_name = "test7";
     errno = EPERM;
     syswarn("perms %d", 7);
 }
-static void test8(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test8(void *data UNUSED)
+{
     message_program_name = "test8";
     errno = EACCES;
     sysdie("%st%s", "fa", "al");
 }
 
-static int return10(void) { return 10; }
+static int
+return10(void)
+{
+    return 10;
+}
 
-static void test9(void *data UNUSED) {
+static void __attribute__((__noreturn__))
+test9(void *data UNUSED)
+{
     message_fatal_cleanup = return10;
     die("fatal");
 }
-static void test10(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test10(void *data UNUSED)
+{
     message_program_name = 0;
     message_fatal_cleanup = return10;
     errno = EPERM;
     sysdie("fatal perm");
 }
-static void test11(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test11(void *data UNUSED)
+{
     message_program_name = "test11";
     message_fatal_cleanup = return10;
     errno = EPERM;
@@ -96,61 +138,104 @@
 }
 
 static void __attribute__((__format__(printf, 2, 0)))
-log_msg(size_t len, const char *format, va_list args, int error) {
+log_msg(size_t len, const char *format, va_list args, int error)
+{
     fprintf(stderr, "%lu %d ", (unsigned long) len, error);
     vfprintf(stderr, format, args);
     fprintf(stderr, "\n");
 }
 
-static void test12(void *data UNUSED) {
+static void
+test12(void *data UNUSED)
+{
     message_handlers_warn(1, log_msg);
     warn("warning");
 }
-static void test13(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test13(void *data UNUSED)
+{
     message_handlers_die(1, log_msg);
     die("fatal");
 }
-static void test14(void *data UNUSED) {
+
+static void
+test14(void *data UNUSED)
+{
     message_handlers_warn(2, log_msg, log_msg);
     errno = EPERM;
     syswarn("warning");
 }
-static void test15(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test15(void *data UNUSED)
+{
     message_handlers_die(2, log_msg, log_msg);
     message_fatal_cleanup = return10;
     errno = EPERM;
     sysdie("fatal");
 }
-static void test16(void *data UNUSED) {
+
+static void
+test16(void *data UNUSED)
+{
     message_handlers_warn(2, message_log_stderr, log_msg);
     message_program_name = "test16";
     errno = EPERM;
     syswarn("warning");
 }
-static void test17(void *data UNUSED) { notice("notice"); }
-static void test18(void *data UNUSED) {
+
+static void
+test17(void *data UNUSED)
+{
+    notice("notice");
+}
+
+static void
+test18(void *data UNUSED)
+{
     message_program_name = "test18";
     notice("notice");
 }
-static void test19(void *data UNUSED) { debug("debug"); }
-static void test20(void *data UNUSED) {
+
+static void
+test19(void *data UNUSED)
+{
+    debug("debug");
+}
+
+static void
+test20(void *data UNUSED)
+{
     message_handlers_notice(1, log_msg);
     notice("foo");
 }
-static void test21(void *data UNUSED) {
+
+static void
+test21(void *data UNUSED)
+{
     message_handlers_debug(1, message_log_stdout);
     message_program_name = "test23";
     debug("baz");
 }
-static void test22(void *data UNUSED) {
+
+static void __attribute__((__noreturn__))
+test22(void *data UNUSED)
+{
     message_handlers_die(0);
     die("hi mom!");
 }
-static void test23(void *data UNUSED) {
+
+static
+void test23(void *data UNUSED)
+{
     message_handlers_warn(0);
     warn("this is a test");
 }
-static void test24(void *data UNUSED) {
+
+static
+void test24(void *data UNUSED)
+{
     notice("first");
     message_handlers_notice(0);
     notice("second");

Modified: 2.6/tests/lib/network/addr-ipv4-t.c
===================================================================
--- 2.6/tests/lib/network/addr-ipv4-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/network/addr-ipv4-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -58,8 +58,11 @@
 int
 main(void)
 {
-    int flag, status;
+#ifdef SO_REUSEADDR
+    int flag;
     socklen_t flaglen;
+#endif
+    int status;
     struct addrinfo *ai, *ai2;
     struct addrinfo hints;
     char addr[INET6_ADDRSTRLEN];

Modified: 2.6/tests/lib/network/addr-ipv6-t.c
===================================================================
--- 2.6/tests/lib/network/addr-ipv6-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/network/addr-ipv6-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,7 +6,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013, 2016, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2012, 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -93,7 +93,7 @@
        "sprint of IPv6 address");
     for (p = addr; *p != '\0'; p++)
         if (islower((unsigned char) *p))
-            *p = toupper((unsigned char) *p);
+            *p = (char) toupper((unsigned char) *p);
     is_string(ipv6_addr, addr, "...with right results");
 
     /* Test network_sockaddr_port. */

Modified: 2.6/tests/lib/network/client-t.c
===================================================================
--- 2.6/tests/lib/network/client-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/network/client-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,7 +6,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2014, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013, 2014, 2016, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2012, 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -50,7 +50,7 @@
  * and expects to always succeed on the connection, taking the source address
  * to pass into network_client_create.
  */
-static void
+static void __attribute__((__noreturn__))
 client_create_writer(const char *source)
 {
     socket_type fd;
@@ -80,7 +80,7 @@
  * sleeps for 10 seconds before sending another string so that timeouts can be
  * tested.  Meant to be run in a child process.
  */
-static void
+static void __attribute__((__noreturn__))
 client_delay_writer(const char *host)
 {
     socket_type fd;
@@ -103,7 +103,7 @@
  * Used to test network_write.  Connects, reads 64KB from the network, then
  * sleeps before reading another 64KB.  Meant to be run in a child process.
  */
-static void
+static void __attribute__((__noreturn__))
 client_delay_reader(const char *host)
 {
     char *buffer;

Modified: 2.6/tests/lib/network/server-t.c
===================================================================
--- 2.6/tests/lib/network/server-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/network/server-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -6,8 +6,8 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016 Russ Allbery <eagle at eyrie.org>
- * Copyright 2009, 2010, 2011, 2012, 2013
+ * Copyright 2005, 2013, 2016-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2009-2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -148,7 +148,7 @@
  * localhost, from the given source address, containing a constant string.
  * This also verifies that network_client_create works properly.
  */
-static void
+static void __attribute__((__noreturn__))
 client_udp_writer(const char *source)
 {
     socket_type fd;
@@ -237,9 +237,14 @@
  * A varient version of the server portion of the test.  Takes an array of
  * sockets and the size of the sockets and accepts a connection on any of
  * those sockets.  Ensures that the client address information is stored
- * correctly by checking that it is set to IPv4 localhost.  For skipping
- * purposes, this produces four tests.
+ * correctly by checking that it is an IPv4 address.  For skipping purposes,
+ * this produces three tests.
  *
+ * Normally, the client address should be 127.0.0.1, but hosts with odd local
+ * networking setups may rewrite client IP addresses so that they appear to
+ * come from other addresses.  Avoid checking if the client IP is 127.0.0.1
+ * for that reason.  Hopefully this won't hide bugs.
+ *
  * saddr is allocated from the heap instead of using a local struct
  * sockaddr_storage to work around a misdiagnosis of strict aliasing
  * violations from gcc 4.4 (fixed in later versions).
@@ -261,9 +266,6 @@
     client = network_accept_any(fds, count, saddr, &slen);
     test_server_connection(client);
     is_int(AF_INET, saddr->sa_family, "...address family is IPv4");
-    is_int(htonl(0x7f000001UL),
-           ((struct sockaddr_in *) (void *) saddr)->sin_addr.s_addr,
-           "...and client address is 127.0.0.1");
     free(saddr);
     for (i = 0; i < count; i++)
         socket_close(fds[i]);
@@ -526,9 +528,17 @@
         is_int(13, length, "...of correct length");
         sin.sin_family = AF_INET;
         sin.sin_port = htons(11119);
-        sin.sin_addr.s_addr = htonl(0x7f000001UL);
+
+        /*
+         * We'd prefer to check that the client IP address is 127.0.0.1 here,
+         * but hosts with odd local networking setups may rewrite the client
+         * IP address to something else.  To avoid false positives, just
+         * blindly trust the client IP address is correct, since it seems
+         * unlikely we'll have a server code bug here.
+         */
+        sin.sin_addr = ((struct sockaddr_in *) &addr)->sin_addr;
         ok(network_sockaddr_equal((struct sockaddr *) &sin, saddr),
-           "...from correct address");
+           "...from correct family and port");
         buffer[13] = '\0';
         is_string("socket test\r\n", buffer, "...and correct contents");
     }
@@ -548,7 +558,7 @@
 main(void)
 {
     /* Set up the plan. */
-    plan(43);
+    plan(42);
 
     /* Test network_bind functions. */
     test_ipv4(NULL);

Modified: 2.6/tests/lib/xmalloc.c
===================================================================
--- 2.6/tests/lib/xmalloc.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/xmalloc.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -5,7 +5,7 @@
  * The canonical version of this file is maintained in the rra-c-util package,
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
- * Copyright 2000, 2001, 2006 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000, 2001, 2006, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2008, 2012, 2013, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -53,7 +53,7 @@
  * A customized error handler for checking xmalloc's support of them.  Prints
  * out the error message and exits with status 1.
  */
-static void
+static void __attribute__((__noreturn__))
 test_handler(const char *function, size_t size, const char *file, int line)
 {
     die("%s %lu %s %d", function, (unsigned long) size, file, line);
@@ -330,7 +330,7 @@
     code = argv[1][0];
     if (isupper(code)) {
         xmalloc_error_handler = test_handler;
-        code = tolower(code);
+        code = (unsigned char) tolower(code);
     }
 
     /*
@@ -393,9 +393,7 @@
     case 'n': exit(test_strndup(size) ? willfail : 1);
     case 'a': exit(test_asprintf(size) ? willfail : 1);
     case 'v': exit(test_vasprintf(size) ? willfail : 1);
-    default:
-        die("Unknown mode %c", argv[1][0]);
-        break;
+    default:  die("Unknown mode %c", argv[1][0]);
     }
     exit(1);
 }

Modified: 2.6/tests/lib/xwrite-t.c
===================================================================
--- 2.6/tests/lib/xwrite-t.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/lib/xwrite-t.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -5,7 +5,7 @@
  * The canonical version of this file is maintained in the rra-c-util package,
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
- * Copyright 2000, 2001, 2002, 2004 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000, 2001, 2002, 2004, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -37,20 +37,15 @@
 #include <errno.h>
 
 #include "tap/basic.h"
+#include "lib/fakewrite.h"
 #include "inn/xwrite.h"
 
 /* The data array we'll use to do testing. */
-char data[256];
+static char data[256];
 
-/* These come from fakewrite. */
-extern char write_buffer[];
-extern size_t write_offset;
-extern int write_interrupt;
-extern int write_fail;
 
-
 static void
-test_write(int status, int total, const char *name)
+test_write(ssize_t status, int total, const char *name)
 {
     is_int(total, status, "%s return status", name);
     ok(memcmp(data, write_buffer, 256) == 0, "%s output", name);
@@ -67,7 +62,7 @@
 
     /* Test xwrite. */
     for (i = 0; i < 256; i++)
-        data[i] = i;
+        data[i] = (char) i;
     test_write(xwrite(0, data, 256), 256, "xwrite");
     write_offset = 0;
     write_interrupt = 1;
@@ -75,10 +70,10 @@
     test_write(xwrite(0, data, 256), 256, "xwrite interrupted");
     write_offset = 0;
     for (i = 0; i < 32; i++)
-        data[i] = i * 2;
+        data[i] = (char) (i * 2);
     test_write(xwrite(0, data, 32), 32, "xwrite first block");
     for (i = 32; i < 65; i++)
-        data[i] = i * 2;
+        data[i] = (char) (i * 2);
     test_write(xwrite(0, data + 32, 33), 33, "xwrite second block");
     write_offset = 0;
     write_interrupt = 0;
@@ -90,7 +85,7 @@
     test_write(xwritev(0, iov, 1), 256, "xwritev");
     write_offset = 0;
     for (i = 0; i < 256; i++)
-        data[i] = i;
+        data[i] = (char) i;
     iov[0].iov_len = 128;
     iov[1].iov_base = &data[128];
     iov[1].iov_len = 16;
@@ -105,11 +100,11 @@
     iov[1].iov_len = 224;
     test_write(xwritev(0, iov, 2), 256, "xwritev interrupted");
     for (i = 0; i < 32; i++)
-        data[i] = i * 2;
+        data[i] = (char) (i * 2);
     write_offset = 0;
     test_write(xwritev(0, iov, 1), 32, "xwritev first block");
     for (i = 32; i < 65; i++)
-        data[i] = i * 2;
+        data[i] = (char) (i * 2);
     iov[0].iov_base = &data[32];
     iov[0].iov_len = 16;
     iov[1].iov_base = &data[48];
@@ -134,21 +129,21 @@
 
     /* Test xpwrite. */
     for (i = 0; i < 256; i++)
-        data[i] = i;
+        data[i] = (char) i;
     test_write(xpwrite(0, data, 256, 0), 256, "xpwrite");
     write_interrupt = 1;
     memset(data + 1, 0, 255);
     test_write(xpwrite(0, data + 1, 255, 1), 255, "xpwrite interrupted");
     for (i = 0; i < 32; i++)
-        data[i + 32] = i * 2;
+        data[i + 32] = (char) (i * 2);
     test_write(xpwrite(0, data + 32, 32, 32), 32, "xpwrite first block");
     for (i = 32; i < 65; i++)
-        data[i + 32] = i * 2;
+        data[i + 32] = (char) (i * 2);
     test_write(xpwrite(0, data + 64, 33, 64), 33, "xpwrite second block");
     write_interrupt = 0;
 
     /* Test failures. */
-    write_fail = 1;
+    write_fail = true;
     test_write(xwrite(0, data + 1, 255), -1, "xwrite fail");
     iov[0].iov_base = data + 1;
     iov[0].iov_len = 255;

Modified: 2.6/tests/runtests.c
===================================================================
--- 2.6/tests/runtests.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/runtests.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -2,6 +2,37 @@
  *
  * Run a set of tests, reporting results.
  *
+ * Test suite driver that runs a set of tests implementing a subset of the
+ * Test Anything Protocol (TAP) and reports the results.
+ *
+ * Any bug reports, bug fixes, and improvements are very much welcome and
+ * should be sent to the e-mail address below.  This program is part of C TAP
+ * Harness <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
+ *
+ * Copyright 2000-2001, 2004, 2006-2018 Russ Allbery <eagle at eyrie.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/*
  * Usage:
  *
  *      runtests [-hv] [-b <build-dir>] [-s <source-dir>] -l <test-list>
@@ -58,32 +89,7 @@
  * If the -v option is given, or the C_TAP_VERBOSE environment variable is set,
  * display the full output of each test as it runs rather than showing a
  * summary of the results of each test.
- *
- * Any bug reports, bug fixes, and improvements are very much welcome and
- * should be sent to the e-mail address below.  This program is part of C TAP
- * Harness <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
- *
- * Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
- *     2014, 2015, 2016 Russ Allbery <eagle at eyrie.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
-*/
+ */
 
 /* Required for fdopen(), getopt(), and putenv(). */
 #if defined(__STRICT_ANSI__) || defined(PEDANTIC)
@@ -450,7 +456,7 @@
 static double
 tv_seconds(const struct timeval *tv)
 {
-    return difftime(tv->tv_sec, 0) + tv->tv_usec * 1e-6;
+    return difftime(tv->tv_sec, 0) + (double) tv->tv_usec * 1e-6;
 }
 
 
@@ -546,6 +552,7 @@
         /* Now, exec our process. */
         if (execl(path, path, (char *) 0) == -1)
             _exit(CHILDERR_EXEC);
+        break;
 
     /* In parent.  Close the extra file descriptor. */
     default:
@@ -1100,6 +1107,7 @@
     struct testset *ts;
     unsigned int chars;
     unsigned long i, first, last, total;
+    double failed;
 
     puts(header);
 
@@ -1108,8 +1116,9 @@
     for (; fails; fails = fails->next) {
         ts = fails->ts;
         total = ts->count - ts->skipped;
+        failed = (double) ts->failed;
         printf("%-26.26s %4lu/%-4lu %3.0f%% %4lu ", ts->file, ts->failed,
-               total, total ? (ts->failed * 100.0) / total : 0,
+               total, total ? (failed * 100.0) / (double) total : 0,
                ts->skipped);
         if (WIFEXITED(ts->status))
             printf("%4d  ", WEXITSTATUS(ts->status));
@@ -1449,7 +1458,7 @@
         fputs("All tests successful", stdout);
     else
         printf("Failed %lu/%lu tests, %.2f%% okay", failed, total,
-               (total - failed) * 100.0 / total);
+               (double) (total - failed) * 100.0 / (double) total);
     if (skipped != 0) {
         if (skipped == 1)
             printf(", %lu test skipped", skipped);

Modified: 2.6/tests/tap/basic.c
===================================================================
--- 2.6/tests/tap/basic.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/basic.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -13,9 +13,9 @@
  * This file is part of C TAP Harness.  The current version plus supporting
  * documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
  *
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
- *     Russ Allbery <eagle at eyrie.org>
- * Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013, 2014
+ * Written by Russ Allbery <eagle at eyrie.org>
+ * Copyright 2009-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2001-2002, 2004-2008, 2011-2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +35,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #include <errno.h>
@@ -72,7 +74,13 @@
 void
 skip(int n UNUSED, const char *reason)
 {
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     new_skip(reason, NULL);
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 }
 
 void
@@ -84,7 +92,13 @@
 void
 skip_block(int n UNUSED, int count, const char *reason)
 {
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     new_skip_block(count, reason, NULL);
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 }
 
 void
@@ -176,8 +190,7 @@
     do {                                        \
         if (format != NULL) {                   \
             va_list args;                       \
-            if (prefix != NULL)                 \
-                printf("%s", prefix);           \
+            printf("%s", prefix);               \
             va_start(args, format);             \
             vprintf(format, args);              \
             va_end(args);                       \
@@ -647,6 +660,41 @@
 
 
 /*
+ * Takes pointers to an expected region of memory and a seen region of memory
+ * and assumes the test passes if the len bytes onwards from them match.
+ * Otherwise reports any bytes which didn't match.
+ */
+int
+is_blob(const void *wanted, const void *seen, size_t len, const char *format,
+        ...)
+{
+    int success;
+    size_t i;
+
+    fflush(stderr);
+    check_diag_files();
+    success = (memcmp(wanted, seen, len) == 0);
+    if (success)
+        printf("ok %lu", testnum++);
+    else {
+        const unsigned char *wanted_c = wanted;
+        const unsigned char *seen_c = seen;
+
+        for (i = 0; i < len; i++) {
+            if (wanted_c[i] != seen_c[i])
+                diag("offset %lu: wanted %02x, seen %02x", (unsigned long) i,
+                     wanted_c[i], seen_c[i]);
+        }
+        printf("not ok %lu", testnum++);
+        _failed++;
+    }
+    PRINT_DESC(" - ", format);
+    putchar('\n');
+    return success;
+}
+
+
+/*
  * Bail out with an error.
  */
 void
@@ -845,6 +893,8 @@
 {
     if (n > 0 && UINT_MAX / n <= size)
         bail("reallocarray too large");
+    if (n == 0)
+        n = 1;
     p = realloc(p, n * size);
     if (p == NULL)
         sysbail("failed to realloc %lu bytes", (unsigned long) (n * size));

Modified: 2.6/tests/tap/basic.h
===================================================================
--- 2.6/tests/tap/basic.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/basic.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -5,7 +5,7 @@
  * This file is part of C TAP Harness.  The current version plus supporting
  * documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
  *
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
+ * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
  *     Russ Allbery <eagle at eyrie.org>
  * Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
@@ -27,6 +27,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_BASIC_H
@@ -128,6 +130,9 @@
     __attribute__((__format__(printf, 3, 4)));
 int is_hex(unsigned long wanted, unsigned long seen, const char *format, ...)
     __attribute__((__format__(printf, 3, 4)));
+int is_blob(const void *wanted, const void *seen, size_t, const char *format,
+            ...)
+    __attribute__((__format__(printf, 4, 5)));
 
 /* Bail out with an error.  sysbail appends strerror(errno). */
 void bail(const char *format, ...)

Modified: 2.6/tests/tap/float.c
===================================================================
--- 2.6/tests/tap/float.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/float.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -11,7 +11,7 @@
  * This file is part of C TAP Harness.  The current version plus supporting
  * documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
  *
- * Copyright 2008, 2010, 2012, 2013, 2014, 2015, 2016
+ * Copyright 2008, 2010, 2012, 2013, 2014, 2015, 2016, 2017
  *     Russ Allbery <eagle at eyrie.org>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -31,6 +31,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 /* Required for isnan() and isinf(). */
@@ -57,6 +59,15 @@
 #endif
 
 /*
+ * Clang 4.0.1 gets very confused by this file and produces warnings about
+ * floating point implicit conversion from the isnan() and isinf() macros.
+ */
+#if defined(__llvm__) || defined(__clang__)
+# pragma clang diagnostic ignored "-Wconversion"
+# pragma clang diagnostic ignored "-Wdouble-promotion"
+#endif
+
+/*
  * Takes an expected double and a seen double and assumes the test passes if
  * those two numbers are within delta of each other.
  */

Modified: 2.6/tests/tap/float.h
===================================================================
--- 2.6/tests/tap/float.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/float.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -24,6 +24,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_FLOAT_H

Modified: 2.6/tests/tap/libtap.sh
===================================================================
--- 2.6/tests/tap/libtap.sh	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/libtap.sh	2018-01-28 21:21:21 UTC (rev 10229)
@@ -33,6 +33,8 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
 
 # Print out the number of test cases we expect to run.
 plan () {

Modified: 2.6/tests/tap/macros.h
===================================================================
--- 2.6/tests/tap/macros.h	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/macros.h	2018-01-28 21:21:21 UTC (rev 10229)
@@ -28,6 +28,8 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
  */
 
 #ifndef TAP_MACROS_H

Modified: 2.6/tests/tap/process.c
===================================================================
--- 2.6/tests/tap/process.c	2018-01-23 21:05:44 UTC (rev 10228)
+++ 2.6/tests/tap/process.c	2018-01-28 21:21:21 UTC (rev 10229)
@@ -15,7 +15,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2002, 2004, 2005, 2013, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2002, 2004, 2005, 2013, 2016, 2017 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2013, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -369,7 +369,7 @@
  * Read the PID of a process from a file.  This is necessary when running
  * under fakeroot to get the actual PID of the remctld process.
  */
-static long
+static pid_t
 read_pidfile(const char *path)
 {
     FILE *file;
@@ -385,7 +385,7 @@
     pid = strtol(buffer, NULL, 10);
     if (pid <= 0)
         bail("cannot read PID from %s", path);
-    return pid;
+    return (pid_t) pid;
 }
 
 



More information about the inn-committers mailing list