test: fix -Wunused-result warnings

This commit is contained in:
Ben Noordhuis 2012-12-14 11:34:17 +01:00
parent e079a99abd
commit 0a05b31a93
2 changed files with 17 additions and 5 deletions

View File

@ -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 File

@ -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;