delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/10/14:43:04

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 10 Jun 2002 14:42:55 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: struct hostent
Message-ID: <20020610184255.GB19457@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <Pine DOT GSO DOT 4 DOT 30L DOT 0206101405310 DOT 21513-100000 AT biohazard-cafe DOT mit DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.30L.0206101405310.21513-100000@biohazard-cafe.mit.edu>
User-Agent: Mutt/1.3.23.1i

On Mon, Jun 10, 2002 at 02:12:19PM -0400, David E Euresti wrote:
>Hello everytime I reinstall a new snapshot of cygwin, I have to modify one
>header file, netdb.h
>
>netdb.h in cygwin declares
>struct	hostent {
>	const char	*h_name;	/* official name of host */
>	char	**h_aliases;	/* alias list */
>	short	h_addrtype;	/* host address type */
>	short	h_length;	/* length of address */
>	char	**h_addr_list;	/* list of addresses from name server */
>#define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
>};
>
>Except Solaris declares it as
>struct	hostent {
>	char	*h_name;	/* official name of host */
>	char	**h_aliases;	/* alias list */
>	short	h_addrtype;	/* host address type */
>	short	h_length;	/* length of address */
>	char	**h_addr_list;	/* list of addresses from name server */
>#define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
>};
>
>And even MSDN declares it as
>struct hostent {
>    char FAR *       h_name;
>    char FAR * FAR * h_aliases;
>    short            h_addrtype;
>    short            h_length;
>    char FAR * FAR * h_addr_list;
>};
>
>notice how h_name is not const.
>Is there any reason why h_name is const in cygwin?

Apparently it's to accommodate an ancient hack in gethostbyname for
dealing with numeric IP addresses.

Looking at gethostbyname, I can see some dreaded static variables;
meaning that this function is not really thread-safe.  It should be
possible to rewrite this to do the right thing, however.  Do you have
an assignment with Red Hat?  We'll gladly accept a patch, if so.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019