1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
This commit is contained in:
Jakub Jelinek
2007-07-12 18:26:36 +00:00
parent 7d58530341
commit 0ecb606cb6
6215 changed files with 494638 additions and 305010 deletions

View File

@ -537,10 +537,7 @@ net_mask(in) /* XXX - should really use system's version of this */
u_int
res_randomid(void) {
struct timeval now;
__gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ __getpid()));
return 0xffff & __getpid();
}
#ifdef _LIBC
libc_hidden_def (__res_randomid)
@ -555,7 +552,7 @@ libc_hidden_def (__res_randomid)
* This routine is not expected to be user visible.
*/
void
res_nclose(res_state statp) {
__res_iclose(res_state statp, bool free_addr) {
int ns;
if (statp->_vcsock >= 0) {
@ -568,13 +565,25 @@ res_nclose(res_state statp) {
#else
for (ns = 0; ns < statp->_u._ext.nscount; ns++)
#endif
if (statp->_u._ext.nsaddrs[ns]
&& statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
if (statp->_u._ext.nsaddrs[ns]) {
if (statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
}
if (free_addr) {
free (statp->_u._ext.nsaddrs[ns]);
statp->_u._ext.nsaddrs[ns] = NULL;
}
}
statp->_u._ext.nsinit = 0;
}
libc_hidden_def (__res_iclose)
void
res_nclose(res_state statp)
{
__res_iclose (statp, true);
}
#ifdef _LIBC
libc_hidden_def (__res_nclose)
#endif
@ -589,14 +598,7 @@ res_thread_freeres (void)
/* Never called res_ninit. */
return;
__res_nclose (&_res); /* Close any VC sockets. */
for (int ns = 0; ns < MAXNS; ns++)
if (_res._u._ext.nsaddrs[ns] != NULL)
{
free (_res._u._ext.nsaddrs[ns]);
_res._u._ext.nsaddrs[ns] = NULL;
}
__res_iclose (&_res, true); /* Close any VC sockets. */
/* Make sure we do a full re-initialization the next time. */
_res.options = 0;