aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorArthur Gautier <baloo@superbaloo.net>2021-10-14 21:43:07 +0000
committerArthur Gautier <baloo@superbaloo.net>2021-10-15 02:59:00 +0000
commit85717eff15fadd625014ed57de80f59304fa67db (patch)
tree24069296f8a5bca81f671140b5328175a329be68 /src/libmain
parentd1da45855c0f7d71bb13928f8028937d3fa062d9 (diff)
preloadNSS: detect glibc
Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc5
1 files changed, 5 insertions, 0 deletions
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 <sys/stat.h>
#include <unistd.h>
#include <signal.h>
+#include <features.h>
+#ifdef __GLIBC__
#include <gnu/lib-names.h>
#include <nss.h>
#include <dlfcn.h>
+#endif
#include <openssl/crypto.h>
@@ -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
});
}