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

Uri Lublin uril at redhat.com
Mon Feb 19 17:58:10 UTC 2018


On 02/19/2018 05:52 PM, Frediano Ziglio wrote:
> 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 indetermidate.

Hi Frediano,

There is a typo in the last word.

I would be more specific, mentioning those are header errors.

(Currently, upon returning -1 in those cases, spice-streaming-agent
  exits).

> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

Acked-by: Uri Lublin <uril 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) {
> 



More information about the Spice-devel mailing list