From d2daffcdcd51ecd79e79c0c22f7936f037b637c1 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Wed, 10 Jul 2024 18:58:44 +0200 Subject: support binding to a specific host address --- scrape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scrape.c') diff --git a/scrape.c b/scrape.c index f68f9b9..f753a87 100644 --- a/scrape.c +++ b/scrape.c @@ -89,7 +89,7 @@ static int timeout_next_millis(scrape_req *reqs); // TCP socket server -scrape_server *scrape_listen(const char *port) { +scrape_server *scrape_listen(const char *host, const char *port) { scrape_server *srv = must_malloc(sizeof *srv); srv->nfds_listen = 0; @@ -110,7 +110,7 @@ scrape_server *scrape_listen(const char *port) { }; struct addrinfo *addrs; - ret = getaddrinfo(0, port, &hints, &addrs); + ret = getaddrinfo(host, port, &hints, &addrs); if (ret != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret)); return false; -- cgit 1.4.1