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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2018-02-19 at 15:52 +0000, 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.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  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) {

Hi, why not, but why not skip this and use the exceptions straight
away?

Lukas
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]