From 57a5a0095c3fe0f22dcbb9d99a82cc94f2b608c7 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 17 Jan 2016 14:30:53 -0800 Subject: Update to rra-c-util 5.10 and C TAP Harness 3.4 Update to rra-c-util 5.10: * Add missing va_end to xasprintf implementation. * Fix Perl test suite framework for new Automake relative paths. * Improve portability to Kerberos included in Solaris 10. * Use appropriate warning flags with Clang (currently not warning clean). Update to C TAP Harness 3.4: * Fix segfault in runtests with an empty test list. * Display verbose test results with -v or C_TAP_VERBOSE. * Test infrastructure builds cleanly with Clang warnings. * Support comments and blank lines in test lists. --- util/macros.h | 4 ++++ util/messages.c | 2 +- util/messages.h | 19 ++++++++++--------- util/xmalloc.c | 5 ++++- util/xmalloc.h | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) (limited to 'util') diff --git a/util/macros.h b/util/macros.h index d071793..4a773a2 100644 --- a/util/macros.h +++ b/util/macros.h @@ -29,6 +29,10 @@ #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #define ARRAY_END(array) (&(array)[ARRAY_SIZE(array)]) +/* Used to name the elements of the array passed to pipe. */ +#define PIPE_READ 0 +#define PIPE_WRITE 1 + /* Used for unused parameters to silence gcc warnings. */ #define UNUSED __attribute__((__unused__)) diff --git a/util/messages.c b/util/messages.c index a43d962..b5c2dba 100644 --- a/util/messages.c +++ b/util/messages.c @@ -225,7 +225,7 @@ message_log_stderr(size_t len UNUSED, const char *fmt, va_list args, int err) * This needs further attention on Windows. For example, it currently doesn't * log the errno information. */ -static void +static void __attribute__((__format__(printf, 3, 0))) message_log_syslog(int pri, size_t len, const char *fmt, va_list args, int err) { char *buffer; diff --git a/util/messages.h b/util/messages.h index 8c731b7..cf91ba7 100644 --- a/util/messages.h +++ b/util/messages.h @@ -84,24 +84,25 @@ void message_handlers_reset(void); * argument list, and the errno setting if any. */ void message_log_stdout(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_stderr(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_debug(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_info(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_notice(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_warning(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_err(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); void message_log_syslog_crit(size_t, const char *, va_list, int) - __attribute__((__nonnull__)); + __attribute__((__format__(printf, 2, 0), __nonnull__)); /* The type of a message handler. */ -typedef void (*message_handler_func)(size_t, const char *, va_list, int); +typedef void (*message_handler_func)(size_t, const char *, va_list, int) + __attribute__((__format__(printf, 2, 0))); /* If non-NULL, called before exit and its return value passed to exit. */ extern int (*message_fatal_cleanup)(void); diff --git a/util/xmalloc.c b/util/xmalloc.c index 721447a..7fb0405 100644 --- a/util/xmalloc.c +++ b/util/xmalloc.c @@ -12,7 +12,7 @@ * buffer = xmalloc(1024); * xrealloc(buffer, 2048); * free(buffer); - * buffer = xcalloc(1024); + * buffer = xcalloc(1, 1024); * free(buffer); * buffer = xstrdup(string); * free(buffer); @@ -62,6 +62,7 @@ * The canonical version of this file is maintained in the rra-c-util package, * which can be found at . * + * Copyright 2015 Russ Allbery * Copyright 2012, 2013, 2014 * The Board of Trustees of the Leland Stanford Junior University * Copyright (c) 2004, 2005, 2006 @@ -258,6 +259,7 @@ x_asprintf(char **strp, const char *file, int line, const char *fmt, ...) status = vasprintf(strp, fmt, args_copy); va_end(args_copy); } + va_end(args); } #else /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */ void @@ -280,5 +282,6 @@ x_asprintf(char **strp, const char *fmt, ...) status = vasprintf(strp, fmt, args_copy); va_end(args_copy); } + va_end(args); } #endif /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */ diff --git a/util/xmalloc.h b/util/xmalloc.h index a4b4686..6aa9b93 100644 --- a/util/xmalloc.h +++ b/util/xmalloc.h @@ -90,7 +90,7 @@ char *x_strdup(const char *, const char *, int) char *x_strndup(const char *, size_t, const char *, int) __attribute__((__malloc__, __nonnull__)); void x_vasprintf(char **, const char *, va_list, const char *, int) - __attribute__((__nonnull__)); + __attribute__((__nonnull__, __format__(printf, 2, 0))); /* asprintf special case. */ #if HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS -- cgit v1.2.3