From 8f61713e88e60e1ae194b933d560633f5a9d1ff5 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 16 Dec 2023 14:59:44 +0100 Subject: [PATCH] sysdeps/managarm: handle more errors in sys_socket --- sysdeps/managarm/generic/file.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sysdeps/managarm/generic/file.cpp b/sysdeps/managarm/generic/file.cpp index 35c9ef295c..bd5cd45935 100644 --- a/sysdeps/managarm/generic/file.cpp +++ b/sysdeps/managarm/generic/file.cpp @@ -769,8 +769,15 @@ int sys_socket(int domain, int type_and_flags, int proto, int *fd) { managarm::posix::SvrResponse 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();