]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket-proxyd: use typesafe resolve_getaddrinfo()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 15 Dec 2018 12:01:06 +0000 (21:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 17 Dec 2018 01:02:36 +0000 (10:02 +0900)
src/socket-proxy/socket-proxyd.c

index 47a2156aa24592b48536a69051d518d28c7e2548..f882a665a8603455e027ffb6e6f1f2e61cccc51f 100644 (file)
@@ -22,6 +22,7 @@
 #include "parse-util.h"
 #include "path-util.h"
 #include "pretty-print.h"
+#include "resolve-private.h"
 #include "set.h"
 #include "socket-util.h"
 #include "string-util.h"
@@ -347,9 +348,7 @@ fail:
         return 0; /* ignore errors, continue serving */
 }
 
-static int resolve_cb(sd_resolve_query *q, int ret, const struct addrinfo *ai, void *userdata) {
-        Connection *c = userdata;
-
+static int resolve_handler(sd_resolve_query *q, int ret, const struct addrinfo *ai, Connection *c) {
         assert(q);
         assert(c);
 
@@ -401,7 +400,7 @@ static int resolve_remote(Connection *c) {
         }
 
         log_debug("Looking up address info for %s:%s", node, service);
-        r = sd_resolve_getaddrinfo(c->context->resolve, &c->resolve_query, node, service, &hints, resolve_cb, c);
+        r = resolve_getaddrinfo(c->context->resolve, &c->resolve_query, node, service, &hints, resolve_handler, NULL, c);
         if (r < 0) {
                 log_error_errno(r, "Failed to resolve remote host: %m");
                 goto fail;