From 85717eff15fadd625014ed57de80f59304fa67db Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Thu, 14 Oct 2021 21:43:07 +0000 Subject: [PATCH] preloadNSS: detect glibc Signed-off-by: Arthur Gautier --- src/libmain/shared.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 93775bed1..1fb2d62d3 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -15,9 +15,12 @@ #include #include #include +#include +#ifdef __GLIBC__ #include #include #include +#endif #include @@ -121,8 +124,10 @@ static void preloadNSS() { been loaded in the parent. So we force a lookup of an invalid domain to force the NSS machinery to load its lookup libraries in the parent before any child gets a chance to. */ std::call_once(dns_resolve_flag, []() { +#ifdef __GLIBC__ dlopen (LIBNSS_DNS_SO, RTLD_NOW); __nss_configure_lookup ("hosts", "dns"); +#endif }); }