[Spice-devel] [PATCH 14/14] Do not test twice for the same condition

Frediano Ziglio fziglio at redhat.com
Thu Feb 15 06:10:26 UTC 2018


>
> From: Christophe de Dinechin <dinechin at redhat.com>
> 
> Signed-off-by: Christophe de Dinechin <dinechin 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 7a3a46d..e825565 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -203,10 +203,10 @@ write_all(int fd, const void *buf, const size_t len)
>      size_t written = 0;
>      while (written < len) {
>          int l = write(fd, (const char *) buf + written, len - written);
> -        if (l < 0 && errno == EINTR) {
> -            continue;
> -        }
>          if (l < 0) {
> +            if (errno == EINTR) {
> +                continue;
> +            }
>              syslog(LOG_ERR, "write failed - %m");
>              return l;
>          }

I don't think it changes a byte in the generated code, but
not hurts:

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

Frediano


More information about the Spice-devel mailing list