Commit ca33941f ca33941fa5583a48b896d37ea7313fafec38bd03 by Sergey Poznyakoff

(util_localname): return FQDN

1 parent 847504ce
......@@ -858,6 +858,7 @@ util_localname ()
char *name;
int name_len = 256;
int status;
struct hostent *hp;
name = malloc (name_len);
while (name
......@@ -873,6 +874,19 @@ util_localname ()
exit (1);
}
hp = gethostbyname (name);
if (hp)
{
struct in_addr inaddr;
inaddr.s_addr = *(unsigned int*)hp->h_addr;
hp = gethostbyaddr ((const char *)&inaddr,
sizeof (struct in_addr), AF_INET);
if (hp)
{
free (name);
name = strdup ((char *)hp->h_name);
}
}
localname = name;
}
return localname;
......