[Spice-devel] [PATCH v2 06/19] Remove unused and obsolete main_channel_close

Pavel Grunt pgrunt at redhat.com
Wed Nov 30 17:34:05 UTC 2016


On Fri, 2016-11-25 at 14:52 +0000, Frediano Ziglio wrote:
> This function wrongly close the first client.
> Wrongly as closing the file descriptor cause a dandling
> file descriptor in the object potentially leading
> to closing another file descriptor open later.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
>  server/main-channel.c | 10 ----------
>  server/main-channel.h |  1 -
>  2 files changed, 11 deletions(-)
> 
> diff --git a/server/main-channel.c b/server/main-channel.c
> index 6449c16..37b2f25 100644
> --- a/server/main-channel.c
> +++ b/server/main-channel.c
> @@ -318,16 +318,6 @@ int main_channel_getpeername(MainChannel
> *main_chan, struct sockaddr *sa, sockle
>          getpeername(red_channel_get_first_socket(RED_CHANNEL(main_c
> han)), sa, salen) : -1;
>  }
>  
> -// TODO: ? shouldn't it disconnect all clients? or shutdown all
> main_channels?
> -void main_channel_close(MainChannel *main_chan)
> -{
> -    int socketfd;
> -
> -    if (main_chan && (socketfd =
> red_channel_get_first_socket(RED_CHANNEL(main_chan))) != -1) {
> -        close(socketfd);
> -    }
> -}
> -
>  MainChannel* main_channel_new(RedsState *reds)
>  {
>      // TODO: set the migration flag of the channel
> diff --git a/server/main-channel.h b/server/main-channel.h
> index 19beb7c..cb53fb4 100644
> --- a/server/main-channel.h
> +++ b/server/main-channel.h
> @@ -61,7 +61,6 @@ RedClient
> *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t
> l
>  MainChannelClient *main_channel_link(MainChannel *, RedClient
> *client,
>       RedsStream *stream, uint32_t link_id, int migration, int
> num_common_caps,
>       uint32_t *common_caps, int num_caps, uint32_t *caps);
> -void main_channel_close(MainChannel *main_chan); // not destroy,
> just socket close
>  void main_channel_push_mouse_mode(MainChannel *main_chan, int
> current_mode, int is_client_mouse_allowed);
>  void main_channel_push_agent_connected(MainChannel *main_chan);
>  void main_channel_push_agent_disconnected(MainChannel *main_chan);


More information about the Spice-devel mailing list