summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/accept_bind.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/syscalls/linux/accept_bind.cc')
-rw-r--r--test/syscalls/linux/accept_bind.cc34
1 files changed, 14 insertions, 20 deletions
diff --git a/test/syscalls/linux/accept_bind.cc b/test/syscalls/linux/accept_bind.cc
index 119a1466b..d8fdb5f10 100644
--- a/test/syscalls/linux/accept_bind.cc
+++ b/test/syscalls/linux/accept_bind.cc
@@ -321,8 +321,7 @@ TEST_P(AllSocketPairTest, AcceptValidAddrLen) {
struct sockaddr_un addr = {};
socklen_t addr_len = sizeof(addr);
ASSERT_THAT(
- accepted = accept(sockets->first_fd(),
- reinterpret_cast<struct sockaddr*>(&addr), &addr_len),
+ accepted = accept(sockets->first_fd(), AsSockAddr(&addr), &addr_len),
SyscallSucceeds());
ASSERT_THAT(close(accepted), SyscallSucceeds());
}
@@ -343,8 +342,7 @@ TEST_P(AllSocketPairTest, AcceptNegativeAddrLen) {
// With a negative addr_len, accept returns EINVAL,
struct sockaddr_un addr = {};
socklen_t addr_len = -1;
- ASSERT_THAT(accept(sockets->first_fd(),
- reinterpret_cast<struct sockaddr*>(&addr), &addr_len),
+ ASSERT_THAT(accept(sockets->first_fd(), AsSockAddr(&addr), &addr_len),
SyscallFailsWithErrno(EINVAL));
}
@@ -535,10 +533,9 @@ TEST_P(AllSocketPairTest, UnboundSenderAddr) {
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
- ASSERT_THAT(
- RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
- reinterpret_cast<sockaddr*>(&addr), &addr_len),
- SyscallSucceedsWithValue(sizeof(i)));
+ ASSERT_THAT(RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
+ AsSockAddr(&addr), &addr_len),
+ SyscallSucceedsWithValue(sizeof(i)));
EXPECT_EQ(addr_len, 0);
}
@@ -570,10 +567,9 @@ TEST_P(AllSocketPairTest, BoundSenderAddr) {
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
- ASSERT_THAT(
- RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
- reinterpret_cast<sockaddr*>(&addr), &addr_len),
- SyscallSucceedsWithValue(sizeof(i)));
+ ASSERT_THAT(RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
+ AsSockAddr(&addr), &addr_len),
+ SyscallSucceedsWithValue(sizeof(i)));
EXPECT_EQ(addr_len, sockets->second_addr_len());
EXPECT_EQ(
memcmp(&addr, sockets->second_addr(),
@@ -609,10 +605,9 @@ TEST_P(AllSocketPairTest, BindAfterConnectSenderAddr) {
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
- ASSERT_THAT(
- RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
- reinterpret_cast<sockaddr*>(&addr), &addr_len),
- SyscallSucceedsWithValue(sizeof(i)));
+ ASSERT_THAT(RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
+ AsSockAddr(&addr), &addr_len),
+ SyscallSucceedsWithValue(sizeof(i)));
EXPECT_EQ(addr_len, sockets->second_addr_len());
EXPECT_EQ(
memcmp(&addr, sockets->second_addr(),
@@ -648,10 +643,9 @@ TEST_P(AllSocketPairTest, BindAfterAcceptSenderAddr) {
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
- ASSERT_THAT(
- RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
- reinterpret_cast<sockaddr*>(&addr), &addr_len),
- SyscallSucceedsWithValue(sizeof(i)));
+ ASSERT_THAT(RetryEINTR(recvfrom)(accepted_fd.get(), &i, sizeof(i), 0,
+ AsSockAddr(&addr), &addr_len),
+ SyscallSucceedsWithValue(sizeof(i)));
EXPECT_EQ(addr_len, sockets->second_addr_len());
EXPECT_EQ(
memcmp(&addr, sockets->second_addr(),