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

Re: [libvirt] [PATCH] Fix undefined reference to 'close_used_without_including_unistd_h'



On Tue, Dec 22, 2009 at 03:16:02AM +0100, Matthias Bolte wrote:
> Found while trying to cross-compile libvirt on Fedora 12 for Windows.
> gnulib redefines 'close' to 'close_used_without_including_unistd_h'
> in sys/socket.h if winsock2.h is present and unistd.h has not been
> included before sys/socket.h. Reorder some includes to fix this.
> ---
>  src/conf/network_conf.c    |    2 +-
>  src/remote/remote_driver.c |   10 +++++-----
>  src/util/util.h            |    1 +
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index ab76f21..a64adf9 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -25,10 +25,10 @@
>  
>  #include <config.h>
>  
> +#include <unistd.h>
>  #include <arpa/inet.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
> -#include <unistd.h>
>  #include <fcntl.h>
>  #include <string.h>
>  #include <dirent.h>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 23fd0e3..be51366 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -23,10 +23,6 @@
>  
>  #include <config.h>
>  
> -/* Windows socket compatibility functions. */
> -#include <errno.h>
> -#include <sys/socket.h>
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> @@ -37,7 +33,11 @@
>  #include <sys/stat.h>
>  #include <fcntl.h>
>  
> -#ifndef HAVE_WINSOCK2_H		/* Unix & Cygwin. */
> +/* Windows socket compatibility functions. */
> +#include <errno.h>
> +#include <sys/socket.h>
> +
> +#ifndef HAVE_WINSOCK2_H /* Unix & Cygwin. */
>  # include <sys/un.h>
>  # include <net/if.h>
>  # include <netinet/in.h>
> diff --git a/src/util/util.h b/src/util/util.h
> index 49b27f2..d556daa 100644
> --- a/src/util/util.h
> +++ b/src/util/util.h
> @@ -27,6 +27,7 @@
>  
>  #include "verify.h"
>  #include "internal.h"
> +#include <unistd.h>
>  #include <sys/select.h>
>  #include <sys/types.h>
>  

  Looks safe, ACK,

    thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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