From 2823e0192e9465f0260d5b43915fb925c5e6bdc8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 15 May 2017 23:24:48 +0200 Subject: tools: support text-based ipc --- src/tools/showconf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/tools/showconf.c') diff --git a/src/tools/showconf.c b/src/tools/showconf.c index 039abee..2453c86 100644 --- a/src/tools/showconf.c +++ b/src/tools/showconf.c @@ -10,7 +10,7 @@ #include #include "subcommands.h" -#include "base64.h" +#include "encoding.h" #include "ipc.h" #include "../uapi.h" @@ -79,16 +79,16 @@ int showconf_main(int argc, char *argv[]) if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6) { char host[4096 + 1]; char service[512 + 1]; - static char buf[sizeof(host) + sizeof(service) + 4]; socklen_t addr_len = 0; - memset(buf, 0, sizeof(buf)); if (peer->endpoint.addr.sa_family == AF_INET) addr_len = sizeof(struct sockaddr_in); else if (peer->endpoint.addr.sa_family == AF_INET6) addr_len = sizeof(struct sockaddr_in6); if (!getnameinfo(&peer->endpoint.addr, addr_len, host, sizeof(host), service, sizeof(service), NI_DGRAM | NI_NUMERICSERV | NI_NUMERICHOST)) { - snprintf(buf, sizeof(buf) - 1, (peer->endpoint.addr.sa_family == AF_INET6 && strchr(host, ':')) ? "[%s]:%s" : "%s:%s", host, service); - printf("Endpoint = %s\n", buf); + if (peer->endpoint.addr.sa_family == AF_INET6 && strchr(host, ':')) + printf("Endpoint = [%s]:%s\n", host, service); + else + printf("Endpoint = %s:%s\n", host, service); } } -- cgit v1.2.3-59-g8ed1b