mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-05 23:03:46 +00:00
service/bsd: Handle Poll with no entries accurately
Testing shows that Poll called with zero entries returns -1 and signals an errno of zero.
This commit is contained in:
parent
f7d59f3e0e
commit
bc699ace15
1 changed files with 5 additions and 0 deletions
|
@ -465,6 +465,11 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u
|
|||
return {-1, Errno::INVAL};
|
||||
}
|
||||
|
||||
if (nfds == 0) {
|
||||
// When no entries are provided, -1 is returned with errno zero
|
||||
return {-1, Errno::SUCCESS};
|
||||
}
|
||||
|
||||
const size_t length = std::min(read_buffer.size(), write_buffer.size());
|
||||
std::vector<PollFD> fds(nfds);
|
||||
std::memcpy(fds.data(), read_buffer.data(), length);
|
||||
|
|
Loading…
Reference in a new issue