*BSD News Article 93132


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!news.kei.com!news.mathworks.com!rill.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.utell.co.uk!usenet
From: brian@shift.utell.net (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: 2.2.1 libresolv.a - gethostbyname() always return NULL
Date: 8 Apr 1997 14:45:50 GMT
Organization: Awfulhak Ltd.
Lines: 28
Message-ID: <5idlmu$fj6@ui-gate.utell.co.uk>
References: <5id2rj$75a@hpg30a.csc.cuhk.edu.hk>
    <5id4ms$8md@ui-gate.utell.co.uk>
Reply-To: brian@awfulhak.org, brian@utell.co.uk
NNTP-Posting-Host: shift.utell.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:38741

In article <5id4ms$8md@ui-gate.utell.co.uk>,
	brian@shift.utell.net (Brian Somers) writes:
> In article <5id2rj$75a@hpg30a.csc.cuhk.edu.hk>,
> 	ktso@dcns.csc.cuhk.edu.hk (SO Kwok Tsun) writes:
>> As subject, I have upgraded one of our FreeBSD box from 2.1.7 to
>> 2.2.1.  I notice a problem with the following program:
>> 
>> #include <netdb.h>
>> #include <stdio.h>
>> 
>> main(){
>>     if (gethostbyname("cuhk.edu.hk")==NULL)
>>         printf("Null\n");
>> }
>> 
>> and I compile it using "cc dns.c -lresolv".  It always return "Null".
>> Anyone met the same problem?
> 
> You've got a resolver problem.  This program should work, and does
> work for me ;)  It's easier to say "nslookup cuhk.edu.hk".

To be fair though, I built the 2.2 system myself.  If there is a
bug in gethostbyname(), it's not on my system.

-- 
Brian <brian@awfulhak.org> <brian@freebsd.org>
      <http://www.awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour !