Set optlen correctly when calling getsockopt.

PiperOrigin-RevId: 253096085
This commit is contained in:
Bhasker Hariharan
2019-06-13 13:41:39 -07:00
committed by Shentubot
parent 94ab253d7e
commit 9f77b36fa1
+2 -1
View File
@@ -679,7 +679,7 @@ TEST_P(TCPSocketPairTest, SetCongestionControlFailsForUnsupported) {
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
char old_cc[kTcpCaNameMax];
socklen_t optlen;
socklen_t optlen = sizeof(old_cc);
ASSERT_THAT(getsockopt(sockets->first_fd(), IPPROTO_TCP, TCP_CONGESTION,
&old_cc, &optlen),
SyscallSucceedsWithValue(0));
@@ -690,6 +690,7 @@ TEST_P(TCPSocketPairTest, SetCongestionControlFailsForUnsupported) {
SyscallFailsWithErrno(ENOENT));
char got_cc[kTcpCaNameMax];
optlen = sizeof(got_cc);
ASSERT_THAT(getsockopt(sockets->first_fd(), IPPROTO_TCP, TCP_CONGESTION,
&got_cc, &optlen),
SyscallSucceedsWithValue(0));