summaryrefslogtreecommitdiffstats
path: root/server/main.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2011-02-03 21:20:02 +0100
committerStefan Fritsch <sf@apache.org>2011-02-03 21:20:02 +0100
commit9ae08fc32576a04da84f2d15971a37585f84e352 (patch)
tree1194d6de1518245fb83d9b6c1678ab0f1ced72b3 /server/main.c
parentOptimize memory access pattern of ap_merge_per_dir_configs() (diff)
downloadapache2-9ae08fc32576a04da84f2d15971a37585f84e352.tar.xz
apache2-9ae08fc32576a04da84f2d15971a37585f84e352.zip
Reload resolv.conf on graceful restarts
PR: 50619 Submitted by: Matt Miller <m miller f5 com>, Stefan Fritsch git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1066944 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/main.c')
-rw-r--r--server/main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/main.c b/server/main.c
index 3ea53d4bb4..de9ac5236a 100644
--- a/server/main.c
+++ b/server/main.c
@@ -44,6 +44,16 @@
#include <unistd.h>
#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+
/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
* extern functions and global data in another appropriate module.
*
@@ -679,6 +689,17 @@ int main(int argc, const char * const argv[])
apr_pool_clear(pconf);
ap_clear_auth_internal();
+/* glibc has __res_init that is #defined to res_init */
+#if HAVE_RES_INIT || HAVE___RES_INIT
+ /*
+ * resolv.conf may have changed, so this will read/reread it.
+ */
+ if (res_init() == -1) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
+ "Resolver initialization failed.");
+ }
+#endif
+
for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
ap_register_hooks(*mod, pconf);
}