summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/afb-socket.c b/src/afb-socket.c
index f4ee7e1e..63de2cf2 100644
--- a/src/afb-socket.c
+++ b/src/afb-socket.c
@@ -178,6 +178,11 @@ static int open_tcp(const char *spec, int server)
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
+ if (server) {
+ hint.ai_flags = AI_PASSIVE;
+ if (host[0] == 0 || (host[0] == '*' && host[1] == 0))
+ host = NULL;
+ }
rc = getaddrinfo(host, service, &hint, &rai);
if (rc != 0) {
errno = EINVAL;