Skip to content

Commit

Permalink
net/SocketDescriptor: use method GetOption() internally
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Nov 25, 2023
1 parent 60033f3 commit 6dc708f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/net/SocketDescriptor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,9 @@ SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol,
int
SocketDescriptor::GetError() const noexcept
{
assert(IsDefined());

int s_err = 0;
socklen_t s_err_size = sizeof(s_err);
return getsockopt(fd, SOL_SOCKET, SO_ERROR,
(char *)&s_err, &s_err_size) == 0
return GetOption(SOL_SOCKET, SO_ERROR,
&s_err, sizeof(s_err)) == sizeof(s_err)
? s_err
: errno;
}
Expand Down

0 comments on commit 6dc708f

Please sign in to comment.