mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Update.
* nss/test-netdb.c (test_hosts): Don't segfault if gethostname returns NULL.
This commit is contained in:
@ -185,12 +185,15 @@ test_hosts (void)
|
||||
if (gethostname (name, namelen) == 0)
|
||||
{
|
||||
printf ("Hostname: %s\n", name);
|
||||
hptr1 = gethostbyname (name);
|
||||
output_hostent ("gethostbyname (gethostname(...))", hptr1);
|
||||
if (name != NULL)
|
||||
{
|
||||
hptr1 = gethostbyname (name);
|
||||
output_hostent ("gethostbyname (gethostname(...))", hptr1);
|
||||
}
|
||||
}
|
||||
|
||||
ip.s_addr = htonl (INADDR_LOOPBACK);
|
||||
hptr1 = gethostbyaddr ((char *)&ip, sizeof(ip), AF_INET);
|
||||
hptr1 = gethostbyaddr ((char *) &ip, sizeof(ip), AF_INET);
|
||||
if (hptr1 != NULL)
|
||||
{
|
||||
printf ("official name of 127.0.0.1: %s\n", hptr1->h_name);
|
||||
|
Reference in New Issue
Block a user