diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-06-19 13:17:49 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-06-19 14:24:23 +0200 |
commit | e4e5b57d23b4ebdbf773fedba91160158f95af94 (patch) | |
tree | cbc97c9ed5d2824b53db57575f4ea9211d5f5ce8 /resolv/res_init.c | |
parent | 26bf5a1029434c98db85947eed11ce3090b2f5db (diff) | |
download | glibc-e4e5b57d23b4ebdbf773fedba91160158f95af94.tar glibc-e4e5b57d23b4ebdbf773fedba91160158f95af94.tar.gz glibc-e4e5b57d23b4ebdbf773fedba91160158f95af94.tar.bz2 glibc-e4e5b57d23b4ebdbf773fedba91160158f95af94.zip |
resolv: Move _res deallocation functions to their own file
Diffstat (limited to 'resolv/res_init.c')
-rw-r--r-- | resolv/res_init.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c index ef2e7c0db4..eb380d3d56 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -83,8 +83,6 @@ #include <sys/types.h> #include <inet/net-internal.h> -#include <not-cancel.h> - /* Options. Should all be left alone. */ /* #undef DEBUG */ @@ -478,56 +476,3 @@ net_mask (struct in_addr in) return (htonl(IN_CLASSB_NET)); return (htonl(IN_CLASSC_NET)); } - -/* - * This routine is for closing the socket if a virtual circuit is used and - * the program wants to close it. This provides support for endhostent() - * which expects to close the socket. - * - * This routine is not expected to be user visible. - */ -void -__res_iclose(res_state statp, bool free_addr) { - int ns; - - if (statp->_vcsock >= 0) { - close_not_cancel_no_status(statp->_vcsock); - statp->_vcsock = -1; - statp->_flags &= ~(RES_F_VC | RES_F_CONN); - } - for (ns = 0; ns < statp->nscount; ns++) - 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; - } - } -} -libc_hidden_def (__res_iclose) - -void -res_nclose(res_state statp) -{ - __res_iclose (statp, true); -} -libc_hidden_def (__res_nclose) - -/* This is called when a thread is exiting to free resources held in _res. */ -static void __attribute__ ((section ("__libc_thread_freeres_fn"))) -res_thread_freeres (void) -{ - if (_res.nscount == 0) - /* Never called res_ninit. */ - return; - - __res_iclose (&_res, true); /* Close any VC sockets. */ - - /* Make sure we do a full re-initialization the next time. */ - _res.options = 0; -} -text_set_element (__libc_thread_subfreeres, res_thread_freeres); -text_set_element (__libc_subfreeres, res_thread_freeres); |