🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.misc
Article #52

Re: Gethostbyname Error

#52
From: Steve Gallichio
Date: Tue, 22 Dec 1992 15:54
40 lines
2005 bytes
Mark Stephan Coyle:
> I am programming on a 4D 310 VGX and am getting a segmentation fault
> whenvever I use the system call "gethostbyname".  The code works on
> other machines, bu not on this sgi.  Any clues?

Dave (the Psychic Debugger) Olson:
> Are you perhaps passing a bogus pointer?

Andrew Cherenson:
> It's important to make sure hp isn't NULL before using it.

RTFM gethostbyname:
> There are two versions of the routines documented in this  manual  entry:
> the  standard C library version and the NIS version in /usr/lib/libsun.a.
> The programmatic interface of both  versions  is  identical,  except  for
> gethostent.   The  standard  version  is the default; if you want the NIS
> version, follow the instructions for  (3Y)  routines  in  intro(3).   The
> differences are described below.

    [...make sure to include -lsun BEFORE -lc_s if you are including
    the c library on the link line... (ed)]

> 
> LIBC VERSION
>    The default resolution order is: query the BIND name server first, if is
>    not configured, then search /etc/hosts.
> 
> NIS VERSION
>    If NIS is enabled, gethostbyname and gethostbyaddr access the NIS
>    databases.  Otherwise, they use the same resolution order as the libc
>    versions.

My guess is that you want to pick up the NIS entry for dexter.psych.umn.edu
but are not getting it without the linking of -lsun.

Hope this helps...now back to my tarot cards.
-- 
Steve Gallichio       |"Have you ever heard of Plato? Aristotle? Socrates?
Cadkey, Inc.          |             ...Morons!"
steveg@cadkey.com     |
Technical Details
Message-ID: <1992Dec22.155450.12429@cadkey.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!cadkey!steveg
References: <1992Dec21.033141.15406@news2.cis.umn.edu> <ts526sg@zuni.esd.sgi.com> <1992Dec21.181140.21504@news2.cis.umn.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.sgi.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!cadkey!steveg
From: steveg@cadkey.com (Steve Gallichio)
Subject: Re: Gethostbyname Error
Message-ID: <1992Dec22.155450.12429@cadkey.com>
Organization: cadkey
References: <1992Dec21.033141.15406@news2.cis.umn.edu> <ts526sg@zuni.esd.sgi.com> <1992Dec21.181140.21504@news2.cis.umn.edu>
Date: Tue, 22 Dec 1992 15:54:50 GMT
Lines: 40