Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!cs.utexas.edu!ut-sally!ut-emx!mic
From: mic@ut-emx.UUCP (Mic (... K[a-z]+) Kaczmarczik)
Newsgroups: comp.windows.x
Subject: Re: X.V11R2 running on a Sun
Summary: 4.3 netdb.h for name resolver conflicts with SunOS libc routines
Message-ID: <3074@ut-emx.UUCP>
Date: 6 Jun 88 00:35:54 GMT
References: <61800003@uxe.cso.uiuc.edu> <12879@joyce.istc.sri.com>
Reply-To: mic@emx.UUCP (Mic Kaczmarczik)
Organization: UT Austin Computation Center, User Services Unix Support Group
Lines: 38

In article <12879@joyce.istc.sri.com> wohler@spam.istc.sri.com (Bill Wohler) writes:
>
>  while we're talking about strange installations of the sun server
>  and clients, note that i recently discovered that the 4.3BSD netdb.h
>  for the nameserver, if installed in /usr/include, will cause all
>  clients to die with a segmentation fault in the XOpenDisplay code.
>
>  it appears that
>
>#define h_addr  h_addr_list[0]  /* address, for backward compatiblity */
>  
>  doesn't work as advertised.  we've noticed this in other
>  applications as well.  can anyone explain?

I had the same problem when I rebuilt X11R2 on our cluster of Suns a
few weeks after after we had installed the 4.3 netdb.h.  I traced
through the code and had it isolated to the line in XOpenDisplay()
that calls gethostbyname().  The problem is that the SunOS libc
versions of gethostbyname(), etc. still use the old definition of
h_addr -- they return a (char *) instead of a (char **), so
XOpenDisplay() was trying to use the host's Internet address as a
character pointer! 

We thought of two solutions: 1) re-install the SunOS netdb.h and only
use the 4.3 netdb.h when building the things we want to use the
resolver library with, or 2) change the Sun makefiles for X to link
everything against the resolver library.  Either way makes the
definitions of h_addr match up again; we opted for the first approach
because it was simpler and required fewer changes to our systems.

--mic--


-- 
Mic Kaczmarczik			If you drink, don't drill.
UT Austin Computation Center			-- Matt Groening
mic@emx.utexas.edu	
MIC@UTAIVC.BITNET