summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-09 12:16:46 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-09 12:16:46 +0200
commitf95d36edba00ec276ec03573a7fdaa6070babd3d (patch)
tree716fcb2f3fbe1c6f19cdc069b5775112d6109433
parent88bc37b955d2a46e55c3ea870fd76846f8fe5fbc (diff)
downloadhittpd-f95d36edba00ec276ec03573a7fdaa6070babd3d.tar.gz
hittpd-f95d36edba00ec276ec03573a7fdaa6070babd3d.tar.xz
hittpd-f95d36edba00ec276ec03573a7fdaa6070babd3d.zip
use AF_UNSPEC if AI_V4MAPPED is not available
Else we can't listen IPv4 only on these systems.
-rw-r--r--hittpd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hittpd.c b/hittpd.c
index 0d33211..f067442 100644
--- a/hittpd.c
+++ b/hittpd.c
@@ -901,11 +901,13 @@ main(int argc, char *argv[])
 	signal(SIGPIPE, SIG_IGN);
 
 	struct addrinfo hints = {
-		.ai_family = AF_INET6,
 		.ai_socktype = SOCK_STREAM,
-		.ai_flags = AI_PASSIVE
 #ifdef AI_V4MAPPED
-		          | AI_V4MAPPED
+		.ai_family = AF_INET6,
+		.ai_flags = AI_PASSIVE | AI_V4MAPPED
+#else
+		.ai_family = AF_UNSPEC,
+		.ai_flags = AI_PASSIVE,
 #endif
 	}, *res;