[glib/mcatanzaro/gresolver-reload: 10/12] gresolver: remove unneeded call to res_init()




commit b0c20ff9ae6e8cba5785cd172a4067188a3efc2d
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Mon Nov 22 14:43:15 2021 -0600

    gresolver: remove unneeded call to res_init()
    
    This call was needed once upon a time, when GResolver had subclasses
    that presumably relied on this. Nowadays, we have only
    GThreadedResolver, which does not need it. res_init() is dangerous
    because it modifies global state, so let's get rid of it.

 gio/gresolver.c |  8 --------
 gio/meson.build | 11 -----------
 2 files changed, 19 deletions(-)
---
diff --git a/gio/gresolver.c b/gio/gresolver.c
index ecc40e87d..0ccc04843 100644
--- a/gio/gresolver.c
+++ b/gio/gresolver.c
@@ -250,11 +250,6 @@ g_resolver_set_default (GResolver *resolver)
   G_UNLOCK (default_resolver);
 }
 
-/* Bionic has res_init() but it's not in any header */
-#ifdef __BIONIC__
-int res_init (void);
-#endif
-
 static void
 g_resolver_maybe_reload (GResolver *resolver)
 {
@@ -266,9 +261,6 @@ g_resolver_maybe_reload (GResolver *resolver)
       if (st.st_mtime != resolver->priv->resolv_conf_timestamp)
         {
           resolver->priv->resolv_conf_timestamp = st.st_mtime;
-#ifdef HAVE_RES_INIT
-          res_init ();
-#endif
           g_signal_emit (resolver, signals[RELOAD], 0);
         }
     }
diff --git a/gio/meson.build b/gio/meson.build
index 29473d26b..5e879fd3d 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -74,17 +74,6 @@ if host_system != 'windows'
     endif
   endif
 
-  # res_init()
-  if cc.links('''#include <sys/types.h>
-                 #include <netinet/in.h>
-                 #include <arpa/nameser.h>
-                 #include <resolv.h>
-                 int main (int argc, char ** argv) {
-                   return res_init();
-                 }''', args : network_args, name : 'res_init()')
-    glib_conf.set('HAVE_RES_INIT', 1)
-  endif
-
   # res_nclose()
   if cc.links('''#include <sys/types.h>
                  #include <netinet/in.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]