Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
test: fix -Wunused-result warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Dec 14, 2012
1 parent e079a99 commit 0a05b31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 11 additions & 3 deletions test/run-tests.c
Expand Up @@ -19,6 +19,7 @@
* IN THE SOFTWARE.
*/

#include <errno.h>
#include <stdio.h>
#include <string.h>

Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions test/runner-unix.c
Expand Up @@ -24,6 +24,7 @@

#include <stdint.h> /* uintptr_t */

#include <errno.h>
#include <unistd.h> /* usleep */
#include <string.h> /* strdup */
#include <stdio.h>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0a05b31

Please sign in to comment.