Avoid modifying any memory on SYS_NET_EINTR cases

This commit is contained in:
RipleyTom 2024-02-09 12:45:27 +01:00 committed by Elad.Ash
parent 56e27bdd49
commit 9b387485b5

View File

@ -1424,13 +1424,13 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr<sys_net_pollfd> fds, s32 n
}
}
std::memcpy(fds.get_ptr(), fds_buf.data(), nfds * sizeof(fds[0]));
if (!has_timedout && !signaled)
{
return -SYS_NET_EINTR;
}
std::memcpy(fds.get_ptr(), fds_buf.data(), nfds * sizeof(fds[0]));
return not_an_error(signaled);
}
@ -1664,6 +1664,11 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptr<sys_net_fd_set
}
}
if (!has_timedout && !signaled)
{
return -SYS_NET_EINTR;
}
if (readfds)
*readfds = rread;
if (writefds)
@ -1671,11 +1676,6 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptr<sys_net_fd_set
if (exceptfds)
*exceptfds = rexcept;
if (!has_timedout && !signaled)
{
return -SYS_NET_EINTR;
}
return not_an_error(signaled);
}