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
|
@ -465,6 +465,11 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u
|
||||||
return {-1, Errno::INVAL};
|
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());
|
const size_t length = std::min(read_buffer.size(), write_buffer.size());
|
||||||
std::vector<PollFD> fds(nfds);
|
std::vector<PollFD> fds(nfds);
|
||||||
std::memcpy(fds.data(), read_buffer.data(), length);
|
std::memcpy(fds.data(), read_buffer.data(), length);
|
||||||
|
|
Reference in New Issue