[Libvir] 17/22 getaddrinfo

Jim Meyering jim at meyering.net
Fri Dec 7 12:30:45 UTC 2007


"Richard W.M. Jones" <rjones at redhat.com> wrote:
> This enables the use of getaddrinfo under Windows (requires inclusion
> of the "getaddrinfo.h" header from gnulib).
>
> AI_ADDRCONFIG isn't supported by the gnulib emulation of
> getaddrinfo. There is some controversy as to whether this flag
> actually does anything useful.
> http://www.google.co.uk/search?q=AI_ADDRCONFIG

I don't know enough to comment.
If there's a good case for it, it belongs in gnulib.

If you add this, you can avoid adding those in-function #ifdefs:
Slightly cleaner, imho, even if you get a redundant (and probably
compiler-eliminated) store instruction on losing systems:

#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
#endif

> +++ src/remote_internal.c	7 Dec 2007 10:59:51 -0000
> @@ -51,6 +65,8 @@
>  #endif
>  #include <libxml/uri.h>
>
> +#include "getaddrinfo.h"
> +
>  #include "internal.h"
>  #include "driver.h"
>  #include "getaddrinfo.h"
> @@ -492,7 +509,9 @@
>          struct addrinfo hints;
>          memset (&hints, 0, sizeof hints);
>          hints.ai_socktype = SOCK_STREAM;
> +#ifdef AI_ADDRCONFIG
>          hints.ai_flags = AI_ADDRCONFIG;
> +#endif




More information about the libvir-list mailing list