mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 11:33:03 +00:00
replay: Propagate error correctly in replay_fread
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
0e5464f152
commit
a931713902
@ -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)))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user