INN commit: trunk (25 files)
INN Commit
rra at isc.org
Thu Dec 4 20:11:38 UTC 2014
Date: Thursday, December 4, 2014 @ 12:11:38
Author: iulius
Revision: 9759
Sync with latest upstream version of rra-c-util
Modified:
trunk/innfeed/Makefile
trunk/lib/Makefile
trunk/lib/asprintf.c
trunk/lib/getaddrinfo.c
trunk/lib/getnameinfo.c
trunk/lib/inet_aton.c
trunk/lib/inet_ntoa.c
trunk/lib/inet_ntop.c
trunk/lib/mkstemp.c
trunk/lib/network-innbind.c
trunk/lib/network.c
trunk/lib/reallocarray.c
trunk/lib/setenv.c
trunk/lib/snprintf.c
trunk/lib/strlcat.c
trunk/lib/strlcpy.c
trunk/lib/xmalloc.c
trunk/lib/xwrite.c
trunk/support/getrra-c-util
trunk/tests/lib/asprintf-t.c
trunk/tests/lib/network/client-t.c
trunk/tests/lib/snprintf-t.c
trunk/tests/lib/xmalloc.c
trunk/tests/lib/xmalloc.t
trunk/tests/tap/process.c
------------------------------+
innfeed/Makefile | 1 +
lib/Makefile | 6 +++---
lib/asprintf.c | 4 +++-
lib/getaddrinfo.c | 3 +++
lib/getnameinfo.c | 4 +++-
lib/inet_aton.c | 3 ++-
lib/inet_ntoa.c | 1 +
lib/inet_ntop.c | 1 +
lib/mkstemp.c | 5 ++++-
lib/network-innbind.c | 11 ++++++++---
lib/network.c | 11 ++++++++---
lib/reallocarray.c | 8 ++++----
lib/setenv.c | 1 +
lib/snprintf.c | 2 ++
lib/strlcat.c | 1 +
lib/strlcpy.c | 1 +
lib/xmalloc.c | 6 +++---
lib/xwrite.c | 7 +++++--
support/getrra-c-util | 8 ++++----
tests/lib/asprintf-t.c | 2 +-
tests/lib/network/client-t.c | 12 +++---------
tests/lib/snprintf-t.c | 4 +++-
tests/lib/xmalloc.c | 5 ++++-
tests/lib/xmalloc.t | 32 ++++++++++++++++----------------
tests/tap/process.c | 5 ++++-
25 files changed, 89 insertions(+), 55 deletions(-)
Modified: innfeed/Makefile
===================================================================
--- innfeed/Makefile 2014-12-01 21:33:16 UTC (rev 9758)
+++ innfeed/Makefile 2014-12-04 20:11:38 UTC (rev 9759)
@@ -56,6 +56,7 @@
mv y.tab.h config_y.h
mv y.tab.c config_y.c
touch config_y.h
+
config_y.h: config_y.c
config_l.c: configfile.l
Modified: lib/Makefile
===================================================================
--- lib/Makefile 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/Makefile 2014-12-04 20:11:38 UTC (rev 9759)
@@ -495,9 +495,9 @@
getnameinfo.o: getnameinfo.c ../include/config.h ../include/inn/defines.h \
../include/inn/system.h ../include/inn/macros.h \
../include/portable/macros.h ../include/portable/stdbool.h \
- ../include/inn/options.h ../include/clibrary.h ../include/config.h \
- ../include/inn/macros.h ../include/portable/socket.h \
- ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h
+ ../include/inn/options.h ../include/portable/socket.h \
+ ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+ ../include/clibrary.h ../include/config.h ../include/inn/macros.h
getpagesize.o: getpagesize.c ../include/config.h ../include/inn/defines.h \
../include/inn/system.h ../include/inn/macros.h \
../include/portable/macros.h ../include/portable/stdbool.h \
Modified: lib/asprintf.c
===================================================================
--- lib/asprintf.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/asprintf.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -20,8 +20,8 @@
*/
#include "config.h"
+#include "portable/macros.h"
#include "clibrary.h"
-#include "portable/macros.h"
#include <errno.h>
@@ -30,6 +30,8 @@
* with the system versions.
*/
#if TESTING
+# undef asprintf
+# undef vasprintf
# define asprintf test_asprintf
# define vasprintf test_vasprintf
int test_asprintf(char **, const char *, ...)
Modified: lib/getaddrinfo.c
===================================================================
--- lib/getaddrinfo.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/getaddrinfo.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -63,6 +63,9 @@
* constants, but that should be okay (except possibly for gai_strerror).
*/
#if TESTING
+# undef gai_strerror
+# undef freeaddrinfo
+# undef getaddrinfo
# define gai_strerror test_gai_strerror
# define freeaddrinfo test_freeaddrinfo
# define getaddrinfo test_getaddrinfo
Modified: lib/getnameinfo.c
===================================================================
--- lib/getnameinfo.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/getnameinfo.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -29,8 +29,9 @@
*/
#include "config.h"
+#include "portable/macros.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
@@ -40,6 +41,7 @@
* constants, but that should be okay (except possibly for gai_strerror).
*/
#if TESTING
+# undef getnameinfo
# define getnameinfo test_getnameinfo
int test_getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t,
char *, socklen_t, int);
Modified: lib/inet_aton.c
===================================================================
--- lib/inet_aton.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/inet_aton.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -25,10 +25,11 @@
#include "portable/socket.h"
/*
- * If we're running the test suite, rename inet_ntoa to avoid conflicts with
+ * If we're running the test suite, rename inet_aton to avoid conflicts with
* the system version.
*/
#if TESTING
+# undef inet_aton
# define inet_aton test_inet_aton
int test_inet_aton(const char *, struct in_addr *);
#endif
Modified: lib/inet_ntoa.c
===================================================================
--- lib/inet_ntoa.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/inet_ntoa.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -30,6 +30,7 @@
* the system version.
*/
#if TESTING
+# undef inet_ntoa
# define inet_ntoa test_inet_ntoa
const char *test_inet_ntoa(const struct in_addr);
#endif
Modified: lib/inet_ntop.c
===================================================================
--- lib/inet_ntop.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/inet_ntop.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -43,6 +43,7 @@
* the system version.
*/
#if TESTING
+# undef inet_ntop
# define inet_ntop test_inet_ntop
const char *test_inet_ntop(int, const void *, char *, socklen_t);
#endif
Modified: lib/mkstemp.c
===================================================================
--- lib/mkstemp.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/mkstemp.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -24,7 +24,10 @@
#include <errno.h>
#include <fcntl.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
/*
* If we're running the test suite, rename mkstemp to avoid conflicts with the
Modified: lib/network-innbind.c
===================================================================
--- lib/network-innbind.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/network-innbind.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -26,6 +26,7 @@
#include "inn/innconf.h"
#include "inn/libinn.h"
+#include "inn/macros.h"
#include "inn/messages.h"
#include "inn/network.h"
#include "inn/network-innbind.h"
@@ -69,7 +70,7 @@
* consistent and easier to understand.
*/
#ifdef IPV6_V6ONLY
-static void
+static void UNUSED
network_set_v6only(socket_type fd)
{
int flag = 1;
@@ -85,7 +86,7 @@
* IPv6 addresses that may not have been set up yet.
*/
#ifdef IP_FREEBIND
-static void
+static void UNUSED
network_set_freebind(socket_type fd)
{
int flag = 1;
@@ -297,9 +298,13 @@
* exist on the system, but we gain the ability to bind to IPv6 addresses
* that aren't yet configured. Since IPv6 address configuration can take
* unpredictable amounts of time during system setup, this is more robust.
+ *
+ * Ensure there is always a block here to avoid compiler warnings, since
+ * network_set_freebind() may expand into nothing.
*/
- if (strcmp(address, "::") != 0)
+ if (strcmp(address, "::") != 0) {
network_set_freebind(fd);
+ }
/* Do the bind. */
bindfd = network_innbind(fd, AF_INET6, address, port);
Modified: lib/network.c
===================================================================
--- lib/network.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/network.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -60,6 +60,7 @@
#include "inn/fdflag.h"
#include "inn/innconf.h"
+#include "inn/macros.h"
#include "inn/messages.h"
#include "inn/network.h"
#include "inn/xmalloc.h"
@@ -121,7 +122,7 @@
* consistent and easier to understand.
*/
#ifdef IPV6_V6ONLY
-static void
+static void UNUSED
network_set_v6only(socket_type fd)
{
int flag = 1;
@@ -137,7 +138,7 @@
* IPv6 addresses that may not have been set up yet.
*/
#ifdef IP_FREEBIND
-static void
+static void UNUSED
network_set_freebind(socket_type fd)
{
int flag = 1;
@@ -241,9 +242,13 @@
* exist on the system, but we gain the ability to bind to IPv6 addresses
* that aren't yet configured. Since IPv6 address configuration can take
* unpredictable amounts of time during system setup, this is more robust.
+ *
+ * Ensure there is always a block here to avoid compiler warnings, since
+ * network_set_freebind() may expand into nothing.
*/
- if (strcmp(address, "::") != 0)
+ if (strcmp(address, "::") != 0) {
network_set_freebind(fd);
+ }
/* Flesh out the socket and do the bind. */
memset(&server, 0, sizeof(server));
Modified: lib/reallocarray.c
===================================================================
--- lib/reallocarray.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/reallocarray.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -2,10 +2,10 @@
*
* Replacement for a missing reallocarray.
*
- * Provides the same functionality as the OpenBSD library function reallocarray
- * for those systems that don't have it. This function is the same as
- * realloc, but takes the size arguments in the same form as calloc and checks
- * for overflow so that the caller doesn't need to.
+ * Provides the same functionality as the OpenBSD library function
+ * reallocarray for those systems that don't have it. This function is the
+ * same as realloc, but takes the size arguments in the same form as calloc
+ * and checks for overflow so that the caller doesn't need to.
*
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
Modified: lib/setenv.c
===================================================================
--- lib/setenv.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/setenv.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -27,6 +27,7 @@
* the system version.
*/
#if TESTING
+# undef setenv
# define setenv test_setenv
int test_setenv(const char *, const char *, int);
#endif
Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/snprintf.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -20,6 +20,8 @@
* conflicts with the system version.
*/
#if TESTING
+# undef snprintf
+# undef vsnprintf
# define snprintf test_snprintf
# define vsnprintf test_vsnprintf
#endif
Modified: lib/strlcat.c
===================================================================
--- lib/strlcat.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/strlcat.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -32,6 +32,7 @@
* the system version.
*/
#if TESTING
+# undef strlcat
# define strlcat test_strlcat
size_t test_strlcat(char *, const char *, size_t);
#endif
Modified: lib/strlcpy.c
===================================================================
--- lib/strlcpy.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/strlcpy.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -31,6 +31,7 @@
* the system version.
*/
#if TESTING
+# undef strlcpy
# define strlcpy test_strlcpy
size_t test_strlcpy(char *, const char *, size_t);
#endif
Modified: lib/xmalloc.c
===================================================================
--- lib/xmalloc.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/xmalloc.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -238,7 +238,7 @@
}
-#if INN_HAVE_C99_VAMACROS || INN_HAVE_GNU_VAMACROS
+#if HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS
void
x_asprintf(char **strp, const char *file, int line, const char *fmt, ...)
{
@@ -260,7 +260,7 @@
va_end(args_copy);
}
}
-#else /* !(INN_HAVE_C99_VAMACROS || INN_HAVE_GNU_VAMACROS) */
+#else /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */
void
x_asprintf(char **strp, const char *fmt, ...)
{
@@ -282,4 +282,4 @@
va_end(args_copy);
}
}
-#endif /* !(INN_HAVE_C99_VAMACROS || INN_HAVE_GNU_VAMACROS) */
+#endif /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */
Modified: lib/xwrite.c
===================================================================
--- lib/xwrite.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ lib/xwrite.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -59,11 +59,14 @@
/*
* If we're running the test suite, call testing versions of the write
- * functions. #undef pwrite first because large file support may define a
- * macro pwrite (pointing to pwrite64) on some platforms (e.g. Solaris).
+ * functions. #undef the functions first since large file support may define
+ * a macro pwrite (pointing to pwrite64) on some platforms (e.g. Solaris),
+ * and it's possible the other functions may be similarly affected.
*/
#if TESTING
# undef pwrite
+# undef write
+# undef writev
# define pwrite fake_pwrite
# define write fake_write
# define writev fake_writev
Modified: support/getrra-c-util
===================================================================
--- support/getrra-c-util 2014-12-01 21:33:16 UTC (rev 9758)
+++ support/getrra-c-util 2014-12-04 20:11:38 UTC (rev 9759)
@@ -73,16 +73,16 @@
# and sourceaddress6 work.
sed -i -e "61 i \\
#include \"inn/innconf.h\"" \
- -e '465 s/)$/ \&\& innconf == NULL)/' \
- -e '466,467d' \
- -e "472 i \\
+ -e '470 s/)$/ \&\& innconf == NULL)/' \
+ -e '471,472d' \
+ -e "477 i \\
if (source == NULL && innconf != NULL)\\
source = innconf->sourceaddress;\\
if (source == NULL ||\\
strcmp(source, \"all\") == 0 || strcmp(source, \"any\") == 0)\\
return true;\\
" \
- -e "485 i \\
+ -e "490 i \\
if (source == NULL && innconf != NULL)\\
source = innconf->sourceaddress6;\\
if (source == NULL ||\\
Modified: tests/lib/asprintf-t.c
===================================================================
--- tests/lib/asprintf-t.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/lib/asprintf-t.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -19,8 +19,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/macros.h"
#include "clibrary.h"
-#include "portable/macros.h"
#include "tap/basic.h"
Modified: tests/lib/network/client-t.c
===================================================================
--- tests/lib/network/client-t.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/lib/network/client-t.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -242,7 +242,7 @@
sysbail("cannot fork");
else if (child == 0) {
alarm(10);
- c = accept(fd, NULL, 0);
+ c = accept(fd, NULL, NULL);
if (c == INVALID_SOCKET)
_exit(1);
sleep(9);
@@ -308,8 +308,6 @@
{
socket_type fd, c;
pid_t child;
- struct sockaddr_in sin;
- socklen_t slen;
char buffer[4];
/* Create the listening socket. */
@@ -332,8 +330,7 @@
alarm(10);
/* Accept the client connection. */
- slen = sizeof(sin);
- c = accept(fd, &sin, &slen);
+ c = accept(fd, NULL, NULL);
if (c == INVALID_SOCKET)
sysbail("cannot accept on socket");
@@ -374,8 +371,6 @@
{
socket_type fd, c;
pid_t child;
- struct sockaddr_in sin;
- socklen_t slen;
char *buffer;
/* Create the data that we're going to send. */
@@ -402,8 +397,7 @@
alarm(10);
/* Accept the client connection. */
- slen = sizeof(struct sockaddr_in);
- c = accept(fd, &sin, &slen);
+ c = accept(fd, NULL, NULL);
if (c == INVALID_SOCKET)
sysbail("cannot accept on socket");
Modified: tests/lib/snprintf-t.c
===================================================================
--- tests/lib/snprintf-t.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/lib/snprintf-t.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -29,7 +29,9 @@
* Disable the requirement that format strings be literals. We need variable
* formats for easy testing.
*/
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
/*
* Intentionally don't add the printf attribute here since we pass a
Modified: tests/lib/xmalloc.c
===================================================================
--- tests/lib/xmalloc.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/lib/xmalloc.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -37,7 +37,10 @@
#include <ctype.h>
#include <errno.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
/* Linux requires sys/time.h be included before sys/resource.h. */
#include <sys/resource.h>
Modified: tests/lib/xmalloc.t
===================================================================
--- tests/lib/xmalloc.t 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/lib/xmalloc.t 2014-12-04 20:11:38 UTC (rev 9759)
@@ -101,46 +101,46 @@
# We assume that there are enough miscellaneous allocations that an allocation
# exactly as large as the limit will always fail.
ok_xmalloc "malloc fail" 1 \
- "failed to malloc 30000000 bytes at xmalloc.c line 38" \
+ "failed to malloc 30000000 bytes at xmalloc.c line 41" \
"m" "30000000" "30000000"
ok_xmalloc "realloc fail" 1 \
- "failed to realloc 30000000 bytes at xmalloc.c line 66" \
+ "failed to realloc 30000000 bytes at xmalloc.c line 69" \
"r" "30000000" "30000000"
ok_xmalloc "reallocarray fail" 1 \
- "failed to reallocarray 30000000 bytes at xmalloc.c line 96" \
+ "failed to reallocarray 30000000 bytes at xmalloc.c line 99" \
"y" "30000000" "30000000"
ok_xmalloc "strdup fail" 1 \
- "failed to strdup 30000000 bytes at xmalloc.c line 127" \
+ "failed to strdup 30000000 bytes at xmalloc.c line 130" \
"s" "30000000" "30000000"
ok_xmalloc "strndup fail" 1 \
- "failed to strndup 30000000 bytes at xmalloc.c line 173" \
+ "failed to strndup 30000000 bytes at xmalloc.c line 176" \
"n" "30000000" "30000000"
ok_xmalloc "calloc fail" 1 \
- "failed to calloc 30000000 bytes at xmalloc.c line 197" \
+ "failed to calloc 30000000 bytes at xmalloc.c line 200" \
"c" "30000000" "30000000"
ok_xmalloc "asprintf fail" 1 \
- "failed to asprintf 30000000 bytes at xmalloc.c line 221" \
+ "failed to asprintf 30000000 bytes at xmalloc.c line 224" \
"a" "30000000" "30000000"
ok_xmalloc "vasprintf fail" 1 \
- "failed to vasprintf 30000000 bytes at xmalloc.c line 240" \
+ "failed to vasprintf 30000000 bytes at xmalloc.c line 243" \
"v" "30000000" "30000000"
# Check our custom error handler.
-ok_xmalloc "malloc custom" 1 "malloc 30000000 xmalloc.c 38" \
+ok_xmalloc "malloc custom" 1 "malloc 30000000 xmalloc.c 41" \
"M" "30000000" "30000000"
-ok_xmalloc "realloc custom" 1 "realloc 30000000 xmalloc.c 66" \
+ok_xmalloc "realloc custom" 1 "realloc 30000000 xmalloc.c 69" \
"R" "30000000" "30000000"
-ok_xmalloc "reallocarray custom" 1 "reallocarray 30000000 xmalloc.c 96" \
+ok_xmalloc "reallocarray custom" 1 "reallocarray 30000000 xmalloc.c 99" \
"Y" "30000000" "30000000"
-ok_xmalloc "strdup custom" 1 "strdup 30000000 xmalloc.c 127" \
+ok_xmalloc "strdup custom" 1 "strdup 30000000 xmalloc.c 130" \
"S" "30000000" "30000000"
-ok_xmalloc "strndup custom" 1 "strndup 30000000 xmalloc.c 173" \
+ok_xmalloc "strndup custom" 1 "strndup 30000000 xmalloc.c 176" \
"N" "30000000" "30000000"
-ok_xmalloc "calloc custom" 1 "calloc 30000000 xmalloc.c 197" \
+ok_xmalloc "calloc custom" 1 "calloc 30000000 xmalloc.c 200" \
"C" "30000000" "30000000"
-ok_xmalloc "asprintf custom" 1 "asprintf 30000000 xmalloc.c 221" \
+ok_xmalloc "asprintf custom" 1 "asprintf 30000000 xmalloc.c 224" \
"A" "30000000" "30000000"
-ok_xmalloc "vasprintf custom" 1 "vasprintf 30000000 xmalloc.c 240" \
+ok_xmalloc "vasprintf custom" 1 "vasprintf 30000000 xmalloc.c 243" \
"V" "30000000" "30000000"
# Check the smaller ones again just for grins.
Modified: tests/tap/process.c
===================================================================
--- tests/tap/process.c 2014-12-01 21:33:16 UTC (rev 9758)
+++ tests/tap/process.c 2014-12-04 20:11:38 UTC (rev 9759)
@@ -50,8 +50,11 @@
# include <sys/select.h>
#endif
#include <sys/stat.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
#include <sys/wait.h>
+#include <time.h>
#include "tap/basic.h"
#include "tap/process.h"
More information about the inn-committers
mailing list