1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

preloadNSS: detect glibc

Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
This commit is contained in:
Arthur Gautier 2021-10-14 21:43:07 +00:00
parent d1da45855c
commit 85717eff15

View file

@ -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
});
}