From: <no...@so...> - 2003-04-29 11:32:58
|
Update of /cvsroot/ijbswa/current In directory sc8-pr-cvs1:/tmp/cvs-serv6551 Modified Files: Tag: v_3_0_branch jbsockets.c Log Message: Don't rely on h_addr being non-NULL after gethostbyname. Works around an oddness in Max OSX and closes bug #724796 Index: jbsockets.c =================================================================== RCS file: /cvsroot/ijbswa/current/Attic/jbsockets.c,v retrieving revision 1.35.2.4 retrieving revision 1.35.2.5 diff -u -d -r1.35.2.4 -r1.35.2.5 --- jbsockets.c 4 Apr 2003 12:40:20 -0000 1.35.2.4 +++ jbsockets.c 29 Apr 2003 11:32:54 -0000 1.35.2.5 @@ -35,6 +35,10 @@ * * Revisions : * $Log$ + * Revision 1.35.2.5 2003/04/29 11:32:54 oes + * Don't rely on h_addr being non-NULL after gethostbyname. + * Works around an oddness in Max OSX and closes bug #724796 + * * Revision 1.35.2.4 2003/04/04 12:40:20 oes * Made sure the errno set by bind, not close[socket] is used in * bind_port. Probably fixes bugs #713777, #705562. @@ -814,7 +818,13 @@ #else hostp = gethostbyname(host); #endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */ - if (hostp == NULL) + /* + * On Mac OSX, if a domain exists but doesn't have a type A + * record associated with it, the h_addr member of the struct + * hostent returned by gethostbyname is NULL, even if h_length + * is 4. Therefore the second test below. + */ + if (hostp == NULL || hostp->h_addr == NULL) { errno = EINVAL; log_error(LOG_LEVEL_ERROR, "could not resolve hostname %s", host); |