mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
(res_init): Handle resolv.conf file with only one nameserver
correctly.
This commit is contained in:
parent
f8598b2b29
commit
5cf6d7a85f
@ -207,13 +207,12 @@ res_init()
|
||||
#ifdef USELOOPBACK
|
||||
_res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
|
||||
_res.nscount = 1;
|
||||
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
|
||||
#else
|
||||
_res.nsaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
_res.nscount = 0;
|
||||
_res.nsaddr.sin_port = 0;
|
||||
#endif
|
||||
_res.nsaddr.sin_family = AF_INET;
|
||||
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
|
||||
_res.ndots = 1;
|
||||
_res.pfcode = 0;
|
||||
|
||||
@ -380,7 +379,7 @@ res_init()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (nserv > 1)
|
||||
if (nserv > _res.nscount)
|
||||
_res.nscount = nserv;
|
||||
#ifdef RESOLVSORT
|
||||
_res.nsort = nsort;
|
||||
@ -572,7 +571,7 @@ netinfo_res_init(haveenv, havesearch)
|
||||
ni_namelist_free(&nl);
|
||||
}
|
||||
|
||||
if (nserv > 1)
|
||||
if (nserv > _res.nscount)
|
||||
_res.nscount = nserv;
|
||||
|
||||
#ifdef RESOLVSORT
|
||||
|
Loading…
x
Reference in New Issue
Block a user