From 0b72b99adabcf02604309a929d52d9c199a70079 Mon Sep 17 00:00:00 2001 From: Akhil Thampy Date: Sat, 14 Dec 2019 18:31:49 -0800 Subject: [PATCH] fix coverage Signed-off-by: Akhil Thampy --- test/common/network/address_impl_test.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/common/network/address_impl_test.cc b/test/common/network/address_impl_test.cc index f28b00c4edcd..95d80fae2b22 100644 --- a/test/common/network/address_impl_test.cc +++ b/test/common/network/address_impl_test.cc @@ -363,6 +363,15 @@ TEST(PipeInstanceTest, AbstractNamespacePermission) { const mode_t mode = 0777; EXPECT_THROW_WITH_REGEX(PipeInstance address("@/foo", mode), EnvoyException, "Cannot set mode for Abstract AF_UNIX sockets"); + + sockaddr_un sun; + sun.sun_family = AF_UNIX; + StringUtil::strlcpy(&sun.sun_path[1], "@/foo", sizeof sun.sun_path); + sun.sun_path[0] = '\0'; + socklen_t ss_len = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sun.sun_path); + + EXPECT_THROW_WITH_REGEX(PipeInstance address(&sun, ss_len, mode), EnvoyException, + "Cannot set mode for Abstract AF_UNIX sockets"); #endif }