From 0a05b31a9300477bede0278fdfc540802a10d1d7 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 14 Dec 2012 11:34:17 +0100 Subject: [PATCH] test: fix -Wunused-result warnings --- test/run-tests.c | 14 +++++++++++--- test/runner-unix.c | 8 ++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/run-tests.c b/test/run-tests.c index d0e64f05d3..324c919440 100644 --- a/test/run-tests.c +++ b/test/run-tests.c @@ -19,6 +19,7 @@ * IN THE SOFTWARE. */ +#include #include #include @@ -99,7 +100,7 @@ static int maybe_run_test(int argc, char **argv) { if (strcmp(argv[1], "spawn_helper3") == 0) { char buffer[256]; - fgets(buffer, sizeof(buffer) - 1, stdin); + ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); buffer[sizeof(buffer) - 1] = '\0'; fputs(buffer, stdout); return 1; @@ -116,8 +117,15 @@ static int maybe_run_test(int argc, char **argv) { DWORD bytes; WriteFile((HANDLE) _get_osfhandle(3), out, strlen(out), &bytes, NULL); #else - write(3, out, strlen(out)); - fsync(3); + { + ssize_t r; + + do + r = write(3, out, strlen(out)); + while (r == -1 && errno == EINTR); + + fsync(3); + } #endif return 1; } diff --git a/test/runner-unix.c b/test/runner-unix.c index 77c68dcd6c..f6ea45e140 100644 --- a/test/runner-unix.c +++ b/test/runner-unix.c @@ -24,6 +24,7 @@ #include /* uintptr_t */ +#include #include /* usleep */ #include /* strdup */ #include @@ -146,8 +147,11 @@ static void* dowait(void* data) { if (args->pipe[1] >= 0) { /* Write a character to the main thread to notify it about this. */ - char c = 0; - write(args->pipe[1], &c, 1); + ssize_t r; + + do + r = write(args->pipe[1], "", 1); + while (r == -1 && errno == EINTR); } return NULL;