preloadNSS: warn if unable to open nss backend

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

View file

@ -125,7 +125,9 @@ static void preloadNSS() {
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);
if (dlopen (LIBNSS_DNS_SO, RTLD_NOW) == NULL) {
printMsg(Verbosity::lvlWarn, fmt("Unable to load nss_dns backend"));
}
__nss_configure_lookup ("hosts", "dns");
#endif
});