[Libguestfs] [PATCH libnbd 1/2] states: Don't assume socket address family is always AF_UNIX.

Eric Blake eblake at redhat.com
Fri Oct 18 15:49:32 UTC 2019


On 10/18/19 10:39 AM, Richard W.M. Jones wrote:
> Get the address family from h->connaddr instead.
> 
> This should make no difference to existing code.
> ---
>   generator/states-connect.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 

ACK

> diff --git a/generator/states-connect.c b/generator/states-connect.c
> index 04e894c..d62b0f5 100644
> --- a/generator/states-connect.c
> +++ b/generator/states-connect.c
> @@ -51,7 +51,8 @@ STATE_MACHINE {
>     int fd;
>   
>     assert (!h->sock);
> -  fd = socket (AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
> +  fd = socket (h->connaddr.ss_family,
> +               SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
>     if (fd == -1) {
>       SET_NEXT_STATE (%.DEAD);
>       set_error (errno, "socket");
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list