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 22, 2023
1 parent efbb2e1 commit 3bccc2e
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 3bccc2e

Please sign in to comment.