]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - resolv/res-close.c
resolv: Do not send queries for non-host-names in nss_dns [BZ #24112]
[thirdparty/glibc.git] / resolv / res-close.c
index 21f038c2c77f737567967cc168b5694510c8cc35..262c15f35815f67c6bfb651be954ed5ecfb71f45 100644 (file)
@@ -1,5 +1,5 @@
 /* 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
@@ -86,6 +86,7 @@
 #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.  */
@@ -94,7 +95,7 @@ __res_iclose (res_state statp, bool free_addr)
 {
   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);
     }
@@ -103,7 +104,7 @@ __res_iclose (res_state statp, bool free_addr)
       {
         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)
@@ -125,8 +126,8 @@ res_nclose (res_state statp)
 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 ();
 
@@ -139,5 +140,5 @@ res_thread_freeres (void)
   /* 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);