Re: [spice-vdagent PATCH v2 2/2] virtio-port: handle_fds: make read and write code consistent

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

 



> 
> A comment and curly brackets for style were added.
> 
> Signed-off-by: Uri Lublin <uril@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

> ---
> 
> v1->v2: use shorter version (alternative of v1)
>         add curly brackets to if blocks
> 
> ---
>  src/vdagentd/virtio-port.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/vdagentd/virtio-port.c b/src/vdagentd/virtio-port.c
> index 3ae7f22..06f3a32 100644
> --- a/src/vdagentd/virtio-port.c
> +++ b/src/vdagentd/virtio-port.c
> @@ -166,14 +166,14 @@ int vdagent_virtio_port_fill_fds(struct
> vdagent_virtio_port *vport,
>  void vdagent_virtio_port_handle_fds(struct vdagent_virtio_port **vportp,
>          fd_set *readfds, fd_set *writefds)
>  {
> -    if (!*vportp)
> -        return;
> -
> -    if (FD_ISSET((*vportp)->fd, readfds))
> +    if (*vportp && FD_ISSET((*vportp)->fd, readfds)) {
>          vdagent_virtio_port_do_read(vportp);
> +    }
>  
> -    if (*vportp && FD_ISSET((*vportp)->fd, writefds))
> +    /* *vportp may have been destroyed in do_read */
> +    if (*vportp && FD_ISSET((*vportp)->fd, writefds)) {
>          vdagent_virtio_port_do_write(vportp);
> +    }
>  }
>  
>  static struct vdagent_virtio_port_buf* vdagent_virtio_port_get_last_wbuf(
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




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