From 404bc5612b7b58d221accdf6ee08b44765759384 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Thu, 19 Mar 2015 17:53:42 +0100 Subject: [PATCH] fix case mixup for inet_pton --- libhttpd/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libhttpd/api.c b/libhttpd/api.c index 5bf2a0f..d78a8be 100644 --- a/libhttpd/api.c +++ b/libhttpd/api.c @@ -273,12 +273,12 @@ httpd *httpdCreate(host, port, ip6) struct sockaddr_in6 *a = (struct sockaddr_in6 *)&addr; a->sin6_family = AF_INET6; a->sin6_port = htons(new->port); - inet_pton( AF_INET6, new->host ? "::" : new->host, &a->sin6_addr ); + inet_pton( AF_INET6, new->host ? new->host : "::", &a->sin6_addr ); } else { struct sockaddr_in *a = (struct sockaddr_in *)&addr; a->sin_family = AF_INET; a->sin_port = htons(new->port); - inet_pton( AF_INET, new->host ? "::" : new->host, &a->sin_addr ); + inet_pton( AF_INET, new->host ? new->host : "0.0.0.0", &a->sin_addr ); } if (bind(sock,(struct sockaddr *)&addr,sizeof(addr)) <0)