nm-daemon-helper: fix build with musl libc

NSS is not available in musl libc:

./src/nm-daemon-helper/nm-daemon-helper.c:9:10: fatal error: nss.h: No such file or directory
    9 | #include <nss.h>
      |          ^~~~~~~
This commit is contained in:
Beniamino Galvani 2021-06-16 18:17:11 +02:00
parent 32bc29591c
commit 9b802ff7f2

View file

@ -6,7 +6,9 @@
#include <stdlib.h>
#include <arpa/inet.h>
#include <netdb.h>
#if defined(__GLIBC__)
#include <nss.h>
#endif
#include "libnm-std-aux/nm-std-aux.h"
@ -68,7 +70,9 @@ cmd_resolve_address(void)
return RETURN_INVALID_ARGS;
memset(&sockaddr, 0, sizeof(sockaddr));
#if defined(__GLIBC__)
__nss_configure_lookup("hosts", "dns");
#endif
if (inet_pton(AF_INET, address, &sockaddr.in.sin_addr) == 1) {
sockaddr.in.sin_family = AF_INET;