INN commit: trunk (23 files)

INN Commit rra at isc.org
Tue Dec 26 20:48:37 UTC 2017


    Date: Tuesday, December 26, 2017 @ 12:48:37
  Author: iulius
Revision: 10201

Sync with latest rra-c-util upstream version

Fix GCC and Clang warnings.  Remove obsolete SA_LEN macro from
INN's portability code (useful when adding IPv6 support to
old code bases that didn't pass address lengths).

Added:
  trunk/tests/lib/fakewrite.h
Modified:
  trunk/configure.ac
  trunk/include/inn/network.h
  trunk/include/inn/xmalloc.h
  trunk/include/portable/socket.h
  trunk/lib/getaddrinfo.c
  trunk/lib/inet_aton.c
  trunk/lib/network.c
  trunk/lib/snprintf.c
  trunk/m4/cc-flags.m4
  trunk/m4/socket.m4
  trunk/support/getrra-c-util
  trunk/tests/lib/fakewrite.c
  trunk/tests/lib/inet_aton-t.c
  trunk/tests/lib/inet_ntoa-t.c
  trunk/tests/lib/inet_ntop-t.c
  trunk/tests/lib/messages-t.c
  trunk/tests/lib/network/addr-ipv6-t.c
  trunk/tests/lib/network/client-t.c
  trunk/tests/lib/network/server-t.c
  trunk/tests/lib/xmalloc.c
  trunk/tests/lib/xwrite-t.c
  trunk/tests/tap/process.c

---------------------------------+
 configure.ac                    |    4 -
 include/inn/network.h           |    4 -
 include/inn/xmalloc.h           |    2 
 include/portable/socket.h       |   24 ------
 lib/getaddrinfo.c               |    6 +
 lib/inet_aton.c                 |    3 
 lib/network.c                   |    6 -
 lib/snprintf.c                  |   56 ++++++++-------
 m4/cc-flags.m4                  |    4 -
 m4/socket.m4                    |   26 -------
 support/getrra-c-util           |    4 -
 tests/lib/fakewrite.c           |   14 +--
 tests/lib/fakewrite.h           |   59 ++++++++++++++++
 tests/lib/inet_aton-t.c         |   44 ++++++------
 tests/lib/inet_ntoa-t.c         |   10 +-
 tests/lib/inet_ntop-t.c         |   12 +--
 tests/lib/messages-t.c          |  139 ++++++++++++++++++++++++++++++--------
 tests/lib/network/addr-ipv6-t.c |    4 -
 tests/lib/network/client-t.c    |    8 +-
 tests/lib/network/server-t.c    |    4 -
 tests/lib/xmalloc.c             |   10 +-
 tests/lib/xwrite-t.c            |   33 +++------
 tests/tap/process.c             |    6 -
 23 files changed, 290 insertions(+), 192 deletions(-)

Modified: configure.ac
===================================================================
--- configure.ac	2017-12-26 20:45:13 UTC (rev 10200)
+++ configure.ac	2017-12-26 20:48:37 UTC (rev 10201)
@@ -618,7 +618,6 @@
 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.
@@ -695,7 +694,6 @@
 dnl   -Wundef               We need portability code.
 dnl   -Wformat-truncation=2 Gives false positives with GCC 7.2.0
 dnl                         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83011
-dnl   -Wduplicated-branches Gives noise because of SA_LEN
 dnl   -Wunsafe-loop-optimizations
 dnl                         Too much noise.
 dnl   -Wcast-qual           Used for a while, but some casts are unavoidable.
@@ -736,7 +734,7 @@
      -Wformat-overflow=2 -Wformat-truncation=1 -Wnull-dereference -Winit-self
      -Wmissing-include-dirs -Wshift-overflow=2
      -Wsync-nand -Wstringop-overflow=4 -Wmissing-format-attribute
-     -Walloc-zero -Walloca -Wduplicated-cond
+     -Walloc-zero -Walloca -Wduplicated-branches -Wduplicated-cond
      -Wtrampolines -Wshadow -Wpointer-arith -Wc99-c11-compat
      -Wbad-function-cast -Wcast-align -Wwrite-strings
      -Wdangling-else -Wdate-time

Modified: include/inn/network.h
===================================================================
--- include/inn/network.h	2017-12-26 20:45:13 UTC (rev 10200)
+++ include/inn/network.h	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: include/inn/xmalloc.h
===================================================================
--- include/inn/xmalloc.h	2017-12-26 20:45:13 UTC (rev 10200)
+++ include/inn/xmalloc.h	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: include/portable/socket.h
===================================================================
--- include/portable/socket.h	2017-12-26 20:45:13 UTC (rev 10200)
+++ include/portable/socket.h	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: lib/getaddrinfo.c
===================================================================
--- lib/getaddrinfo.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ lib/getaddrinfo.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: lib/inet_aton.c
===================================================================
--- lib/inet_aton.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ lib/inet_aton.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -37,7 +37,8 @@
 int
 inet_aton(const char *s, struct in_addr *addr)
 {
-    unsigned long octet[4], address;
+    unsigned long octet[4];
+    uint32_t address;
     const char *p;
     int base, i;
     int part = 0;

Modified: lib/network.c
===================================================================
--- lib/network.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ lib/network.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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

Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ lib/snprintf.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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)
@@ -82,6 +87,7 @@
  *    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 xemacs.org> 2000-11-04
  *    include <config.h> instead of "config.h".
@@ -114,7 +120,6 @@
 #include <string.h>
 #include <ctype.h>
 #include <sys/types.h>
-#include "inn/messages.h"
 
 #ifndef NULL
 # define NULL 0
@@ -136,15 +141,15 @@
 int snprintf (char *str, size_t count, const char *fmt, ...);
 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
 
-static int dopr (char *buffer, size_t maxlen, const char *format,
+static int dopr (char *buffer, size_t maxlen, const char *format, 
                  va_list args);
 static int fmtstr (char *buffer, size_t *currlen, size_t maxlen,
-                   const char *value, int flags, int min, int max);
+		   const char *value, int flags, int min, int max);
 static int fmtint (char *buffer, size_t *currlen, size_t maxlen,
-                   LLONG value, int base, int min, int max, int flags);
+		   LLONG value, int base, int min, int max, int flags);
 static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
-                  LDOUBLE fvalue, int min, int max, int flags);
-static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c);
+		  LDOUBLE fvalue, int min, int max, int flags);
+static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
 
 /*
  * dopr(): poor man's version of doprintf
@@ -377,7 +382,7 @@
 	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':
@@ -387,7 +392,7 @@
 	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':
@@ -398,7 +403,7 @@
 	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;
@@ -405,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 *);
@@ -421,7 +427,7 @@
 	{
 	  short int *num;
 	  num = va_arg (args, short int *);
-	  *num = currlen;
+	  *num = (short) currlen;
         } 
 	else if (cflags == DP_C_LONG) 
 	{
@@ -439,7 +445,7 @@
 	{
 	  int *num;
 	  num = va_arg (args, int *);
-	  *num = currlen;
+	  *num = (int) currlen;
         }
 	break;
       case '%':
@@ -488,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);*/
@@ -520,9 +526,9 @@
 /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
 
 static int fmtint (char *buffer, size_t *currlen, size_t maxlen,
-                   LLONG value, int base, int min, int max, int flags)
+		   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;
@@ -576,8 +582,8 @@
     spadlen = -spadlen; /* Left Justifty */
 
 #ifdef DEBUG_SNPRINTF
-  debug("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 */
@@ -643,7 +649,7 @@
 
   intpart = (LLONG) value;
   value = value - intpart;
-  if (value >= 0.5)
+  if (value >= (LDOUBLE) 0.5)
     intpart++;
 
   return intpart;
@@ -658,16 +664,16 @@
 #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)
+		  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;
@@ -719,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;
 	}
     }
@@ -767,9 +773,9 @@
 
 #ifdef DEBUG_SNPRINTF
 # ifdef HAVE_LONG_LONG_INT
-  debug("fmtfp: %Lf =? %lld.%lld\n", fvalue, intpart, fracpart);
+  debug ("fmtfp: %Lf =? %lld.%lld\n", fvalue, intpart, fracpart);
 # else
-  debug("fmtfp: %Lf =? %ld.%ld\n", fvalue, intpart, fracpart);
+  debug ("fmtfp: %Lf =? %ld.%ld\n", fvalue, intpart, fracpart);
 # endif
 #endif
 

Modified: m4/cc-flags.m4
===================================================================
--- m4/cc-flags.m4	2017-12-26 20:45:13 UTC (rev 10200)
+++ m4/cc-flags.m4	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: m4/socket.m4
===================================================================
--- m4/socket.m4	2017-12-26 20:45:13 UTC (rev 10200)
+++ m4/socket.m4	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: support/getrra-c-util
===================================================================
--- support/getrra-c-util	2017-12-26 20:45:13 UTC (rev 10200)
+++ support/getrra-c-util	2017-12-26 20:48:37 UTC (rev 10201)
@@ -193,11 +193,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 +307,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: tests/lib/fakewrite.c
===================================================================
--- tests/lib/fakewrite.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/fakewrite.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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;
 
 
 /*

Added: tests/lib/fakewrite.h
===================================================================
--- tests/lib/fakewrite.h	                        (rev 0)
+++ tests/lib/fakewrite.h	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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 */


Property changes on: trunk/tests/lib/fakewrite.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Modified: tests/lib/inet_aton-t.c
===================================================================
--- tests/lib/inet_aton-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/inet_aton-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/inet_ntoa-t.c
===================================================================
--- tests/lib/inet_ntoa-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/inet_ntoa-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/inet_ntop-t.c
===================================================================
--- tests/lib/inet_ntop-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/inet_ntop-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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;
 }

Modified: tests/lib/messages-t.c
===================================================================
--- tests/lib/messages-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/messages-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/network/addr-ipv6-t.c
===================================================================
--- tests/lib/network/addr-ipv6-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/network/addr-ipv6-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/network/client-t.c
===================================================================
--- tests/lib/network/client-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/network/client-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/network/server-t.c
===================================================================
--- tests/lib/network/server-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/network/server-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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
  *
@@ -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;

Modified: tests/lib/xmalloc.c
===================================================================
--- tests/lib/xmalloc.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/xmalloc.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/lib/xwrite-t.c
===================================================================
--- tests/lib/xwrite-t.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/lib/xwrite-t.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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: tests/tap/process.c
===================================================================
--- tests/tap/process.c	2017-12-26 20:45:13 UTC (rev 10200)
+++ tests/tap/process.c	2017-12-26 20:48:37 UTC (rev 10201)
@@ -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