sysdeps/managarm: handle end of lane and fs errors in getpeername
@@ -214,12 +214,16 @@ int sys_peername(int fd, struct sockaddr *addr_ptr, socklen_t max_addr_length,
HEL_CHECK(offer.error());
HEL_CHECK(sendReq.error());
HEL_CHECK(recvResp.error());
+ if (recvData.error() != kHelErrEndOfLane)
HEL_CHECK(recvData.error());
managarm::fs::SvrResponse<MemoryAllocator> resp(getSysdepsAllocator());
resp.ParseFromArray(recvResp.data(), recvResp.length());
- if(resp.error() == managarm::fs::Errors::ILLEGAL_REQUEST) {
+ if(resp.error() == managarm::fs::Errors::ILLEGAL_REQUEST
+ || resp.error() == managarm::fs::Errors::ILLEGAL_OPERATION_TARGET) {
return ENOTSOCK;
+ }else if(resp.error() == managarm::fs::Errors::NOT_CONNECTED) {
+ return ENOTCONN;
}else{
__ensure(resp.error() == managarm::fs::Errors::SUCCESS);
*actual_length = resp.file_size();
