[Spice-commits] server/red-replay-qxl.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Sep 21 17:00:34 UTC 2016


 server/red-replay-qxl.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit a93171390201718a773110ffb847185176becc0b
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Sep 15 18:47:00 2016 +0100

    replay: Propagate error correctly in replay_fread
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 6e2bbb6..0cf442b 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -57,16 +57,14 @@ struct SpiceReplay {
     pthread_cond_t cond;
 };
 
-static int replay_fread(SpiceReplay *replay, uint8_t *buf, size_t size)
+static ssize_t replay_fread(SpiceReplay *replay, uint8_t *buf, size_t size)
 {
-    if (replay->error) {
-        return 0;
-    }
-    if (feof(replay->fd)) {
+    if (replay->error || feof(replay->fd) ||
+        fread(buf, 1, size, replay->fd) != size) {
         replay->error = TRUE;
         return 0;
     }
-    return fread(buf, size, 1, replay->fd);
+    return size;
 }
 
 __attribute__((format(scanf, 2, 3)))


More information about the Spice-commits mailing list