Use AF_UNSPEC for the getaddrinfo() hints

network.c defines _POSIX_C_SOURCE before pulling in the socket headers.
On FreeBSD that hides the non-standard PF_* aliases from <sys/socket.h>,
so PF_UNSPEC is undeclared and the build fails:

  src/common/network.c:169:20: error: use of undeclared identifier 'PF_UNSPEC'

getaddrinfo() is specified in terms of the AF_* constants anyway, and the
rest of the file already uses AF_INET, so use AF_UNSPEC here too.
This commit is contained in:
Piotr Kubaj authored and Piotr Kubaj committed 2026-10-25 20:10:14 +01:00
1 parent d691ffcffd
commit 5bb6b77e98
1 file changed
+1 -1
+1 -1
View File
@@ -166,7 +166,7 @@ net_resolve (netstore * ns, char *hostname, int port, char **real_host)
sprintf (portstring, "%d", port); sprintf (portstring, "%d", port);
memset (&hints, 0, sizeof (struct addrinfo)); memset (&hints, 0, sizeof (struct addrinfo));
hints.ai_family = PF_UNSPEC; /* support ipv6 and ipv4 */ hints.ai_family = AF_UNSPEC; /* support ipv6 and ipv4 */
hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;