summaryrefslogtreecommitdiff
path: root/tests/libntp/sockaddrtest.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2020-03-04 13:59:29 +0000
committerCy Schubert <cy@FreeBSD.org>2020-03-04 13:59:29 +0000
commit5171bc9b11192d9ad273db7854787eaa65eb9997 (patch)
treeb872a53605ef14ae76de1104afb4be189d1a958a /tests/libntp/sockaddrtest.c
parent360c01464aee3bc4c520898a675f35967db09ac2 (diff)
Diffstat (limited to 'tests/libntp/sockaddrtest.c')
-rw-r--r--tests/libntp/sockaddrtest.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/libntp/sockaddrtest.c b/tests/libntp/sockaddrtest.c
index bd893bd429a2..bbf669c78487 100644
--- a/tests/libntp/sockaddrtest.c
+++ b/tests/libntp/sockaddrtest.c
@@ -31,7 +31,13 @@ IsEqual(const sockaddr_u expected, const sockaddr_u actual) {
sizeof( in )) == 0) {
return TRUE;
} else {
- printf("IPv4 comparision failed, expected: %s(%s) but was: %s(%s)",inet_ntoa(expected.sa4.sin_addr), socktoa(&expected), inet_ntoa(actual.sa4.sin_addr),socktoa(&actual));
+ char buf[4][32];
+ strlcpy(buf[0], inet_ntoa(expected.sa4.sin_addr), sizeof(buf[0]));
+ strlcpy(buf[1], socktoa(&expected) , sizeof(buf[1]));
+ strlcpy(buf[2], inet_ntoa(actual.sa4.sin_addr) , sizeof(buf[2]));
+ strlcpy(buf[3], socktoa(&actual) , sizeof(buf[3]));
+ printf("IPv4 comparision failed, expected: %s(%s) but was: %s(%s)",
+ buf[0], buf[1], buf[2], buf[3]);
return FALSE;
}
} else if (actual.sa.sa_family == AF_INET6) { //IPv6