1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Kernel: Use KResult a bit more in the IPv4 networking code

This commit is contained in:
Andreas Kling 2021-01-31 12:13:16 +01:00
parent b00799b9ce
commit 9984201634
7 changed files with 23 additions and 21 deletions

View file

@ -225,9 +225,9 @@ KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer&
#endif
if (type() == SOCK_RAW) {
int err = routing_decision.adapter->send_ipv4(routing_decision.next_hop, m_peer_address, (IPv4Protocol)protocol(), data, data_length, m_ttl);
if (err < 0)
return KResult((ErrnoCode)-err);
auto result = routing_decision.adapter->send_ipv4(routing_decision.next_hop, m_peer_address, (IPv4Protocol)protocol(), data, data_length, m_ttl);
if (result.is_error())
return result;
return data_length;
}