Re: [Qemu-devel] [PATCH 1/4] qga: drop unused sockaddr in accept(2) call

2016-10-07 Thread Michael Roth
Quoting Stefan Hajnoczi (2016-10-06 11:40:15)
> ga_channel_listen_accept() is currently hard-coded to support only
> AF_UNIX because the struct sockaddr_un type is used.  This function
> should work with any address family.
> 
> Drop the sockaddr since the client address is unused and is an optional
> argument to accept(2).
> 
> Signed-off-by: Stefan Hajnoczi 

Reviewed-by: Michael Roth 

> ---
>  qga/channel-posix.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
> index bb65d8b..bf32158 100644
> --- a/qga/channel-posix.c
> +++ b/qga/channel-posix.c
> @@ -26,13 +26,10 @@ static gboolean ga_channel_listen_accept(GIOChannel 
> *channel,
>  GAChannel *c = data;
>  int ret, client_fd;
>  bool accepted = false;
> -struct sockaddr_un addr;
> -socklen_t addrlen = sizeof(addr);
> 
>  g_assert(channel != NULL);
> 
> -client_fd = qemu_accept(g_io_channel_unix_get_fd(channel),
> -(struct sockaddr *), );
> +client_fd = qemu_accept(g_io_channel_unix_get_fd(channel), NULL, NULL);
>  if (client_fd == -1) {
>  g_warning("error converting fd to gsocket: %s", strerror(errno));
>  goto out;
> -- 
> 2.7.4
> 




[Qemu-devel] [PATCH 1/4] qga: drop unused sockaddr in accept(2) call

2016-10-06 Thread Stefan Hajnoczi
ga_channel_listen_accept() is currently hard-coded to support only
AF_UNIX because the struct sockaddr_un type is used.  This function
should work with any address family.

Drop the sockaddr since the client address is unused and is an optional
argument to accept(2).

Signed-off-by: Stefan Hajnoczi 
---
 qga/channel-posix.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index bb65d8b..bf32158 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -26,13 +26,10 @@ static gboolean ga_channel_listen_accept(GIOChannel 
*channel,
 GAChannel *c = data;
 int ret, client_fd;
 bool accepted = false;
-struct sockaddr_un addr;
-socklen_t addrlen = sizeof(addr);
 
 g_assert(channel != NULL);
 
-client_fd = qemu_accept(g_io_channel_unix_get_fd(channel),
-(struct sockaddr *), );
+client_fd = qemu_accept(g_io_channel_unix_get_fd(channel), NULL, NULL);
 if (client_fd == -1) {
 g_warning("error converting fd to gsocket: %s", strerror(errno));
 goto out;
-- 
2.7.4