From 22918a033bf057b37574a73734641d6e7dc01ae5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 5 Apr 2016 18:40:37 +0200 Subject: [PATCH] tevent:testsuite: fix O3 errors unused result for read Signed-off-by: Michael Adam Reviewed-by: Christian Ambach --- lib/tevent/testsuite.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c index bcd27fd7863..013bc3231c2 100644 --- a/lib/tevent/testsuite.c +++ b/lib/tevent/testsuite.c @@ -38,6 +38,15 @@ static int fde_count; +static void do_read(int fd, void *buf, size_t count) +{ + ssize_t ret; + + do { + ret = read(fd, buf, count); + } while (ret == -1 && errno == EINTR); +} + static void fde_handler_read(struct tevent_context *ev_ctx, struct tevent_fd *f, uint16_t flags, void *private_data) { @@ -48,7 +57,7 @@ static void fde_handler_read(struct tevent_context *ev_ctx, struct tevent_fd *f, #endif kill(getpid(), SIGALRM); - read(fd[0], &c, 1); + do_read(fd[0], &c, 1); fde_count++; } @@ -72,7 +81,7 @@ static void fde_handler_read_1(struct tevent_context *ev_ctx, struct tevent_fd * #endif kill(getpid(), SIGALRM); - read(fd[1], &c, 1); + do_read(fd[1], &c, 1); fde_count++; } -- 2.34.1