Catch another case missed in last change.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20068 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-09-15 09:29:06 +00:00
parent e594a48208
commit ea38c81c95

View file

@ -3769,7 +3769,8 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
int multi = 0; int multi = 0;
int found = 0; int found = 0;
int rval; int rval;
char *local_hostname=NULL; char *first_dot = 0;
char *local_hostname = 0;
if (len == 0) if (len == 0)
{ {
@ -3810,8 +3811,6 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
*/ */
if (multi || host == 0 || *host == '\0') if (multi || host == 0 || *host == '\0')
{ {
char *first_dot;
local_hostname = xgethostname(); local_hostname = xgethostname();
if (!local_hostname) if (!local_hostname)
{ {
@ -3826,9 +3825,14 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
} }
host = local_hostname; host = local_hostname;
} }
if ((hp = gethostbyname(host)) == 0) if ((hp = gethostbyname(host)) == 0 && first_dot != 0)
{ {
sprintf(ebuf, "gethostbyname() failed: %s", strerror(errno)); *first_dot = '.';
hp = gethostbyname(host);
}
if (hp == 0)
{
sprintf(ebuf, "gethostbyname('%s') failed: %s", host, strerror(errno));
gdomap_log(LOG_ERR); gdomap_log(LOG_ERR);
return -1; return -1;
} }