net/SocketDescriptor: use method GetOption() internally
This commit is contained in:
parent
60033f3eb4
commit
6dc708f53f
|
@ -191,12 +191,9 @@ SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol,
|
||||||
int
|
int
|
||||||
SocketDescriptor::GetError() const noexcept
|
SocketDescriptor::GetError() const noexcept
|
||||||
{
|
{
|
||||||
assert(IsDefined());
|
|
||||||
|
|
||||||
int s_err = 0;
|
int s_err = 0;
|
||||||
socklen_t s_err_size = sizeof(s_err);
|
return GetOption(SOL_SOCKET, SO_ERROR,
|
||||||
return getsockopt(fd, SOL_SOCKET, SO_ERROR,
|
&s_err, sizeof(s_err)) == sizeof(s_err)
|
||||||
(char *)&s_err, &s_err_size) == 0
|
|
||||||
? s_err
|
? s_err
|
||||||
: errno;
|
: errno;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue