mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Add getpeername() syscall, and fix getsockname() behavior.
We were copying the raw IPv4 addresses into the wrong part of sockaddr_in, and we didn't set sa_family or sa_port.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -78,4 +80,10 @@ int getsockname(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int getpeername(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
|
||||
{
|
||||
int rc = syscall(SC_getpeername, sockfd, addr, addrlen);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user