diff options
author | Leah Neukirchen <leah@vuxu.org> | 2024-07-10 18:58:44 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-07-10 18:58:44 +0200 |
commit | d2daffcdcd51ecd79e79c0c22f7936f037b637c1 (patch) | |
tree | bd71a6da57e5d063bb143d4e3731fa85cc9cdea0 /scrape.c | |
parent | 653dc9cd6836d505abc1cf988b7e7186ff742f6d (diff) | |
download | nano-exporter-d2daffcdcd51ecd79e79c0c22f7936f037b637c1.tar.gz nano-exporter-d2daffcdcd51ecd79e79c0c22f7936f037b637c1.tar.xz nano-exporter-d2daffcdcd51ecd79e79c0c22f7936f037b637c1.zip |
support binding to a specific host address
Diffstat (limited to 'scrape.c')
-rw-r--r-- | scrape.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |