Index: panel-plugin/weather-http.c =================================================================== --- panel-plugin/weather-http.c (revision 4855) +++ panel-plugin/weather-http.c (working copy) @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include #include +#include #include #include @@ -118,7 +120,25 @@ return FALSE; } +static void refresh_resolvers(void) +{ +#ifdef G_OS_UNIX + static time_t resolv_conf_changed = (time_t)NULL; + struct stat s; + /* This makes the glibc re-read resolv.conf, if it changed + * since our startup. + * Why doesn't the glibc do it by itself? + */ + if (stat("/etc/resolv.conf", &s) == 0) { + if (s.st_mtime > resolv_conf_changed) { + resolv_conf_changed = s.st_mtime; + res_init(); + } + } /* else + we'll have bigger problems. */ +#endif /*G_OS_UNIX*/ +} static gboolean weather_http_receive_data_idle (gpointer user_data) @@ -135,6 +155,9 @@ /* set the current time */ g_get_current_time (&timeout); + /* force the libc to get resolvers right, if they changed for some reason */ + refresh_resolvers(); + /* try to get the hostname */ host = gethostbyname (connection->proxy_host ? connection->proxy_host : connection->hostname); if (G_UNLIKELY (host == NULL)) Index: panel-plugin/Makefile.am =================================================================== --- panel-plugin/Makefile.am (revision 4855) +++ panel-plugin/Makefile.am (working copy) @@ -45,7 +45,8 @@ $(LIBXFCE4UTIL_LIBS) \ $(LIBXFCEGUI4_LIBS) \ $(GTK_LIBS) \ - $(LIBXML_LIBS) + $(LIBXML_LIBS) \ + $(LIBRESOLV) desktopdir = $(datadir)/xfce4/panel-plugins desktop_in_in_files = weather.desktop.in.in Index: configure.in.in =================================================================== --- configure.in.in (revision 4855) +++ configure.in.in (working copy) @@ -63,6 +63,9 @@ XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1]) XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0]) +AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv]) +AC_SUBST(LIBRESOLV) + dnl *********************************** dnl *** Check for debugging support *** dnl ***********************************