mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:28:13 +00:00
Kernel: getpeername() should fail with ENOTCONN for non-connected sockets.
This commit is contained in:
parent
709893364d
commit
14a202f011
1 changed files with 3 additions and 0 deletions
|
@ -2266,6 +2266,9 @@ int Process::sys$getpeername(int sockfd, sockaddr* addr, socklen_t* addrlen)
|
|||
|
||||
auto& socket = *descriptor->socket();
|
||||
|
||||
if (!socket.is_connected())
|
||||
return -ENOTCONN;
|
||||
|
||||
if (!socket.get_peer_address(addr, addrlen))
|
||||
return -EINVAL; // FIXME: Should this be another error? I'm not sure.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue