debug: fix -O3 warning - unused return code of write()
authorMichael Adam <obnox@samba.org>
Tue, 22 Mar 2016 22:01:10 +0000 (23:01 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 12 May 2016 22:16:15 +0000 (00:16 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
lib/util/debug.c

index 4bb54d7de48ca33f2cb6e8e90728a83832834538..95b3d95f06231cd19156973f25d43171b22f5ca5 100644 (file)
@@ -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: