/* Deallocation functions for the resolver state.
- Copyright (C) 1995-2017 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <resolv_context.h>
#include <resolv_conf.h>
#include <not-cancel.h>
+#include <stdlib.h>
/* Close all open sockets. If FREE_ADDR is true, deallocate any
separately allocated name server addresses. */
{
if (statp->_vcsock >= 0)
{
- close_not_cancel_no_status (statp->_vcsock);
+ __close_nocancel_nostatus (statp->_vcsock);
statp->_vcsock = -1;
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
}
{
if (statp->_u._ext.nssocks[ns] != -1)
{
- close_not_cancel_no_status (statp->_u._ext.nssocks[ns]);
+ __close_nocancel_nostatus (statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
}
if (free_addr)
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)
+void
+__res_thread_freeres (void)
{
__resolv_context_freeres ();
/* 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);
+/* Also must be called when the main thread exits. */
+text_set_element (__libc_subfreeres, __res_thread_freeres);