[Spice-devel] [spice-server PATCH 8/8] red-record-qxl: child_output_setup: check fcntl return value

Uri Lublin uril at redhat.com
Sun Oct 16 11:44:55 UTC 2016


Also replaced "continue" in while block with an empty
block (added curly braces).

Found by coverity.

Signed-off-by: Uri Lublin <uril at redhat.com>
---
 server/red-record-qxl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index adc487b..21fc35f 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -845,13 +845,18 @@ void red_record_qxl_command(RedRecord *record, RedMemSlotInfo *slots,
 static void child_output_setup(gpointer user_data)
 {
     int fd = GPOINTER_TO_INT(user_data);
+    int r;
 
     while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
     }
     close(fd);
 
     // make sure file is not closed calling exec()
-    fcntl(STDOUT_FILENO, F_SETFD, 0);
+    while ((r = fcntl(STDOUT_FILENO, F_SETFD, 0)) < 0 && errno == EINTR) {
+    }
+    if (r < 0) {
+        spice_error("fcntl F_SETFD failed (%d)\n", errno);
+    }
 }
 
 RedRecord *red_record_new(const char *filename)
-- 
2.7.4



More information about the Spice-devel mailing list