Skip to content

Commit

Permalink
sysdeps/managarm: handle more errors in sys_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectrodeYT committed Dec 16, 2023
1 parent abd16bb commit 8f61713
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sysdeps/managarm/generic/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,15 @@ int sys_socket(int domain, int type_and_flags, int proto, int *fd) {

managarm::posix::SvrResponse<MemoryAllocator> resp(getSysdepsAllocator());
resp.ParseFromArray(recvResp.data(), recvResp.length());
if(resp.error() == managarm::posix::Errors::ILLEGAL_ARGUMENTS) {
if(resp.error() == managarm::posix::Errors::ADDRESS_FAMILY_NOT_SUPPORTED) {
return EAFNOSUPPORT;
} else if(resp.error() == managarm::posix::Errors::NOT_SUPPORTED
|| resp.error() == managarm::posix::Errors::ILLEGAL_ARGUMENTS) {
return EINVAL;
} else if(resp.error() == managarm::posix::Errors::PROTOCOL_NOT_SUPPORTED) {
return EPROTONOSUPPORT;
} else if(resp.error() == managarm::posix::Errors::INTERNAL_ERROR) {
return EIEIO;
} else {
__ensure(resp.error() == managarm::posix::Errors::SUCCESS);
*fd = resp.fd();
Expand Down

0 comments on commit 8f61713

Please sign in to comment.