diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /resolv/res_init.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'resolv/res_init.c')
-rw-r--r-- | resolv/res_init.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c index b5a03d1883..731c784e17 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -537,7 +537,10 @@ net_mask(in) /* XXX - should really use system's version of this */ u_int res_randomid(void) { - return 0xffff & __getpid(); + struct timeval now; + + __gettimeofday(&now, NULL); + return (0xffff & (now.tv_sec ^ now.tv_usec ^ __getpid())); } #ifdef _LIBC libc_hidden_def (__res_randomid) @@ -552,7 +555,7 @@ libc_hidden_def (__res_randomid) * This routine is not expected to be user visible. */ void -__res_iclose(res_state statp, bool free_addr) { +res_nclose(res_state statp) { int ns; if (statp->_vcsock >= 0) { @@ -565,25 +568,13 @@ __res_iclose(res_state statp, bool free_addr) { #else for (ns = 0; ns < statp->_u._ext.nscount; ns++) #endif - 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; - } + 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; } 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 @@ -598,7 +589,14 @@ res_thread_freeres (void) /* Never called res_ninit. */ return; - __res_iclose (&_res, true); /* Close any VC sockets. */ + __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; + } /* Make sure we do a full re-initialization the next time. */ _res.options = 0; |