[Spice-devel] [PATCH spice-streaming-agent v2 1/5] Be more restrictive about error handling

Frediano Ziglio fziglio at redhat.com
Tue Feb 20 14:30:25 UTC 2018


There's no much point in ignoring the error if these errors cause the
communication to be out of sync.
Ignoring them just change the state to indeterminate.

Signed-off-by: Frediano Ziglio <fziglio 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 45a92b9..1f41a6f 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -94,17 +94,17 @@ static int read_command_from_device(void)
     if (hdr.protocol_version != STREAM_DEVICE_PROTOCOL) {
         syslog(LOG_WARNING, "BAD VERSION %d (expected is %d)\n", hdr.protocol_version,
                STREAM_DEVICE_PROTOCOL);
-        return 0; // return -1; -- fail over this ?
+        return -1;
     }
     if (hdr.type != STREAM_TYPE_START_STOP) {
         syslog(LOG_WARNING, "UNKNOWN msg of type %d\n", hdr.type);
-        return 0; // return -1;
+        return -1;
     }
     if (hdr.size >= sizeof(msg)) {
         syslog(LOG_WARNING,
                "msg size (%d) is too long (longer than %lu)\n",
                hdr.size, sizeof(msg));
-        return 0; // return -1;
+        return -1;
     }
     n = read(streamfd, &msg, hdr.size);
     if (n != hdr.size) {
-- 
2.14.3



More information about the Spice-devel mailing list