[Spice-devel] [PATCH 14/14] Do not test twice for the same condition

Christophe de Dinechin christophe at dinechin.org
Wed Feb 14 17:52:22 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 src/spice-streaming-agent.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 7a3a46d..e825565 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -203,10 +203,10 @@ write_all(int fd, const void *buf, const size_t len)
     size_t written = 0;
     while (written < len) {
         int l = write(fd, (const char *) buf + written, len - written);
-        if (l < 0 && errno == EINTR) {
-            continue;
-        }
         if (l < 0) {
+            if (errno == EINTR) {
+                continue;
+            }
             syslog(LOG_ERR, "write failed - %m");
             return l;
         }
-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list