gethostbyname() bug

Mike Link (Michael.K.Link-1@tc.umn.edu)
Thu, 21 Nov 96 01:38:37 +0100


I am curious if there has been any modifications to the
gethostbyname(const char*) function in netdb.h for Linux 2.1.*. I have
experienced a problem with a program that compiled with no warnings at
all, but crashes when the gethostbyname(const char*) function is called.
I originally compiled this same program on Linux 2.0.25 and 1.2.13 with
no problems what so ever, but have recently discovered that when this
same program is run on Linux using Kernel version 2.1.5 or 2.1.7 the
process will receive a segfault signal when that function is called. gcc
2.7 was used to compiled on the machine running 2.1.5 and gcc 2.7.2 on
the machine running 2.1.7. gcc 2.6.3 on the machine running 1.2.13.
When I used gdb to try and trace the problem it claimed it had gone
through the function tolower(char) and when I changed the only 2 places
in the program that used the function tolower(char) to the function
toupper(char) gdb claimed that the cout << member function was causing
the problem... I isolated the problem exactly to the gethostbyname(const
char*) function by placing to 2 cout statements on either side of it and
alternated with 2 printf() statements since gdb wasn't very insightful...

any insight as to if this is a bug or something else would be much
appreciated. (maybe a problem with gcc on Linux?)

<-> polygon@rox.org
<-> polygon@marvin.starweb.net
<-> link0031@tc.umn.edu (Michael.K.Link-1@tc.umn.edu)

<-> http://www.rox.org/~polygon/
<-> http://www.starweb.net/static/