mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
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:
parent
8ff9b21f8d
commit
bec71bd8e2
1 changed files with 9 additions and 5 deletions
|
@ -3769,7 +3769,8 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
|
|||
int multi = 0;
|
||||
int found = 0;
|
||||
int rval;
|
||||
char *local_hostname=NULL;
|
||||
char *first_dot = 0;
|
||||
char *local_hostname = 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')
|
||||
{
|
||||
char *first_dot;
|
||||
|
||||
local_hostname = xgethostname();
|
||||
if (!local_hostname)
|
||||
{
|
||||
|
@ -3826,9 +3825,14 @@ nameServer(const char* name, const char* host, int op, int ptype, struct sockadd
|
|||
}
|
||||
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 -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue