[libc-commits] [libc] [libc] Add socket test support library (PR #193207)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Wed Apr 22 00:54:23 PDT 2026
================
@@ -33,15 +33,7 @@ TEST_F(LlvmLibcListenTest, ListenLocalSocket) {
ASSERT_ERRNO_SUCCESS();
struct sockaddr_un my_addr;
-
- my_addr.sun_family = AF_UNIX;
- unsigned int i = 0;
- for (;
- SOCK_PATH[i] != '\0' && (i < sizeof(sockaddr_un) - sizeof(sa_family_t));
- ++i)
- my_addr.sun_path[i] = SOCK_PATH[i];
-
- my_addr.sun_path[i] = '\0';
+ ASSERT_TRUE(LIBC_NAMESPACE::testing::make_sockaddr_un(SOCK_PATH, my_addr));
----------------
labath wrote:
Yes. (the only reason it can fail is if the socket path is too long and doesn't fit in sun_path).
https://github.com/llvm/llvm-project/pull/193207
More information about the libc-commits
mailing list