Permalink
Browse files

test: fix -Wunused-result warnings

  • Loading branch information...
1 parent e079a99 commit 0a05b31a9300477bede0278fdfc540802a10d1d7 @bnoordhuis bnoordhuis committed Dec 14, 2012
Showing with 17 additions and 5 deletions.
  1. +11 −3 test/run-tests.c
  2. +6 −2 test/runner-unix.c
View
@@ -19,6 +19,7 @@
* IN THE SOFTWARE.
*/
+#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -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;
}
View
@@ -24,6 +24,7 @@
#include <stdint.h> /* uintptr_t */
+#include <errno.h>
#include <unistd.h> /* usleep */
#include <string.h> /* strdup */
#include <stdio.h>
@@ -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;

0 comments on commit 0a05b31

Please sign in to comment.