Minor improvement in usability

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20064 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-09-14 15:31:13 +00:00
parent d427f1afd3
commit cd7e2f1453
2 changed files with 11 additions and 4 deletions

View file

@ -3,6 +3,8 @@
* Source/NSDateFormatter.m:
* Source/NSNumberFormatter.m:
Tolerate being given null pointers to return values in.
* Tools/gdomap.c: Try both short and long forms of local host name.
Report host name used when gethostbyname() fails.
2004-09-13 Adrian Robert <arobert@cogsci.ucsd.edu>

View file

@ -3971,8 +3971,8 @@ donames(const char *host)
unsigned short num = 0;
int rval;
uptr b;
char *first_dot;
char *local_hostname=NULL;
char *first_dot = 0;
char *local_hostname = NULL;
#if GDOMAP_PORT_OVERRIDE
p = htons(GDOMAP_PORT_OVERRIDE);
@ -4007,9 +4007,14 @@ donames(const char *host)
}
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);
return;
}