[omniORB] Incorrect gethostbyname_r usage on OSF
Bhatia, Neeraj
Neeraj.Bhatia@compaq.com
Thu, 18 May 2000 15:06:35 -0400
Hi All,
I found a problem while using omniORB 2.8 on OSF. It does not initialize the
hostent_data structure, which is used to call gethostbyname_r call.
The man page for gethostbyname_r call says to initialize this structure.
>From the man page:
Note that you must zero-fill the hdptr structure before its first access by
the gethostbyname_r() function.
This bug causes intermittent problems and causes a crash in gethostbyname_r
called routine.
I hope this fix is included in the future builds.
Regards.
Neeraj Bhatia
Compaq Computer Corporation
Source File: libcWrapper.cc
#elif defined(__osf1__)
// Use gethostbyname_r() on Digital UNIX
if (!h.pd_buffer) {
h.pd_buffer = new char[sizeof(struct hostent_data)];
// My addition----------------------------------------------------------
memset (h.pd_buffer, 0, sizeof (struct hostent_data));
// My addition----------------------------------------------------------
// XXX Is it possible that the pointer h.pd_buffer is at a wrong
alignment
// for a struct hostent_data?
h.pd_buflen = sizeof(struct hostent_data);
}
if (gethostbyname_r(name,&h.pd_ent,(struct hostent_data *)h.pd_buffer) < 0)
{
if (errno) {
.........