bug-gnulib
[Top][All Lists]
Advanced

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

Re: gethostname fix for mingw (was: Re: Problem with gethostbyname)


From: Bruno Haible
Subject: Re: gethostname fix for mingw (was: Re: Problem with gethostbyname)
Date: Thu, 23 Oct 2008 13:49:24 +0200
User-agent: KMail/1.5.4

Ben Pfaff wrote:
> --- a/lib/unistd.in.h
> +++ b/lib/unistd.in.h
> @@ -281,8 +281,17 @@ extern int getdtablesize (void);
>     If the host name is longer than LEN, set errno = EINVAL and return -1.
>     Return 0 if successful, otherwise set errno and return -1.  */
>  # if address@hidden@
> +#  if HAVE_WINSOCK2_H
> +#   /* Bypass bad prototype for gethostname(). */
> +#   include <winsock2.h>
> +#   undef gethostname
> +#   define gethostname rpl_gethostname
> +#  endif
>  extern int gethostname(char *name, size_t len);
>  # endif
> +#elif @UNISTD_H_HAVE_WINSOCK2_H@
> +# undef gethostname
> +# define gethostname 
> gethostname_used_without_requesting_gnulib_module_gethostname
>  #elif defined GNULIB_POSIXCHECK
>  # undef gethostname
>  # define gethostname(n,l) \

Yes, this looks all right. Only use @UNISTD_H_HAVE_WINSOCK2_H@ instead
of HAVE_WINSOCK2_H in line 284 above.

Thanks!

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]