Signed-off-by: Lukáš Hrázký <lhrazky@xxxxxxxxxx> --- src/spice-streaming-agent.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp index 8b3f833..5dd41a9 100644 --- a/src/spice-streaming-agent.cpp +++ b/src/spice-streaming-agent.cpp @@ -166,14 +166,11 @@ static void handle_stream_error(size_t len) static void read_command_from_device(void) { StreamDevHeader hdr; - int n; std::lock_guard<std::mutex> stream_guard(stream_mtx); - n = read(streamfd, &hdr, sizeof(hdr)); - if (n != sizeof(hdr)) { - throw std::runtime_error("read command from device FAILED -- read " + std::to_string(n) + - " expected " + std::to_string(sizeof(hdr))); - } + + read_all(&hdr, sizeof(hdr)); + if (hdr.protocol_version != STREAM_DEVICE_PROTOCOL) { throw std::runtime_error("BAD VERSION " + std::to_string(hdr.protocol_version) + " (expected is " + std::to_string(STREAM_DEVICE_PROTOCOL) + ")"); -- 2.16.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel