aboutsummaryrefslogtreecommitdiff
path: root/tests/tap/basic.c
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2016-01-17 14:30:53 -0800
committerRuss Allbery <eagle@eyrie.org>2016-01-17 14:30:53 -0800
commit57a5a0095c3fe0f22dcbb9d99a82cc94f2b608c7 (patch)
treed7ab6169e2c5af79d97711964c34fbc1f5bbab13 /tests/tap/basic.c
parent884297fc439a4c3eba2365cdb810214dfc4f5799 (diff)
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.
Diffstat (limited to 'tests/tap/basic.c')
-rw-r--r--tests/tap/basic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/tap/basic.c b/tests/tap/basic.c
index 92a749b..4f8be04 100644
--- a/tests/tap/basic.c
+++ b/tests/tap/basic.c
@@ -12,7 +12,8 @@
* This file is part of C TAP Harness. The current version plus supporting
* documentation is at <http://www.eyrie.org/~eagle/software/c-tap-harness/>.
*
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015
+ * Russ Allbery <eagle@eyrie.org>
* Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013, 2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -105,7 +106,7 @@ static struct cleanup_func *cleanup_funcs = NULL;
/*
* Registered diag files. Any output found in these files will be printed out
* as if it were passed to diag() before any other output we do. This allows
- * background processes to log to a file and have that output interleved with
+ * background processes to log to a file and have that output interleaved with
* the test output.
*/
struct diag_file {
@@ -192,7 +193,7 @@ check_diag_files(void)
struct diag_file *file;
fpos_t where;
size_t length;
- int incomplete;
+ int size, incomplete;
/*
* Walk through each file and read each line of output available. The
@@ -216,7 +217,8 @@ check_diag_files(void)
/* Continue until we get EOF or an incomplete line of data. */
incomplete = 0;
while (!feof(file->file) && !incomplete) {
- if (fgets(file->buffer, file->bufsize, file->file) == NULL) {
+ size = file->bufsize > INT_MAX ? INT_MAX : (int) file->bufsize;
+ if (fgets(file->buffer, size, file->file) == NULL) {
if (ferror(file->file))
sysbail("cannot read from %s", file->name);
continue;
@@ -807,7 +809,7 @@ bstrndup(const char *s, size_t n)
/* Don't assume that the source string is nul-terminated. */
for (p = s; (size_t) (p - s) < n && *p != '\0'; p++)
;
- length = p - s;
+ length = (size_t) (p - s);
copy = malloc(length + 1);
if (p == NULL)
sysbail("failed to strndup %lu bytes", (unsigned long) length);