From af83bc39202f743c9f51c472d73ede58fd81d971 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Mar 2016 23:01:10 +0100 Subject: [PATCH] debug: fix -O3 warning - unused return code of write() Signed-off-by: Michael Adam Reviewed-by: Christian Ambach --- lib/util/debug.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/util/debug.c b/lib/util/debug.c index 4bb54d7de48..95b3d95f062 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -139,8 +139,12 @@ static int debug_level_to_priority(int level) static void debug_file_log(int msg_level, const char *msg, const char *msg_no_nl) { + ssize_t ret; + check_log_size(); - write(state.fd, msg, strlen(msg)); + do { + ret = write(state.fd, msg, strlen(msg)); + } while (ret == -1 && errno == EINTR); } #ifdef WITH_SYSLOG @@ -1114,7 +1118,10 @@ static void Debug1(const char *msg) case DEBUG_DEFAULT_STDOUT: case DEBUG_DEFAULT_STDERR: if (state.fd > 0) { - write(state.fd, msg, strlen(msg)); + ssize_t ret; + do { + ret = write(state.fd, msg, strlen(msg)); + } while (ret == -1 && errno == EINTR); } break; case DEBUG_FILE: