mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 18:20:10 +01:00
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:
parent
32bc29591c
commit
9b802ff7f2
1 changed files with 4 additions and 0 deletions
|
|
@ -6,7 +6,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#if defined(__GLIBC__)
|
||||||
#include <nss.h>
|
#include <nss.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libnm-std-aux/nm-std-aux.h"
|
#include "libnm-std-aux/nm-std-aux.h"
|
||||||
|
|
||||||
|
|
@ -68,7 +70,9 @@ cmd_resolve_address(void)
|
||||||
return RETURN_INVALID_ARGS;
|
return RETURN_INVALID_ARGS;
|
||||||
|
|
||||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||||
|
#if defined(__GLIBC__)
|
||||||
__nss_configure_lookup("hosts", "dns");
|
__nss_configure_lookup("hosts", "dns");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (inet_pton(AF_INET, address, &sockaddr.in.sin_addr) == 1) {
|
if (inet_pton(AF_INET, address, &sockaddr.in.sin_addr) == 1) {
|
||||||
sockaddr.in.sin_family = AF_INET;
|
sockaddr.in.sin_family = AF_INET;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue