Are you testing the return value for null before using it? gethostbyname() returns a null pointer when it detects an error. Dereferencing that null pointer would segfault your program.

Jon Gardiner

[EMAIL PROTECTED] wrote:

UUG friends,

I have a linux program that is segfaulting on the gethostbyname()
function. I suspect something must not be right with my hostname
configuration. (I'm on redhat enterprise 3). Below are some related files.
the man pages say that gethostbyname returns a struct given a host name.
Where is it looking for that information?

$ cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
192.168.28.21   xsfsa.example.com

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=xsfsa.example.com

ideas?

mrb



____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list




____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to