fix: BSD socket assertion failure in PollImpl

Initialize PollFD.revents field to prevent assertion failures when
copying from read buffer. The assertion was failing because revents
contained uninitialized data from the buffer.

Thanks to Dr.Stug for providing the logs that identified this issue.

Fixes assertion failure at core\hle\service\sockets\bsd.cpp:564

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-10-22 20:47:24 +10:00
parent b27d22d3f6
commit 4c7ee4ac3b

View File

@@ -546,6 +546,11 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<con
std::vector<PollFD> fds(nfds);
std::memcpy(fds.data(), read_buffer.data(), nfds * sizeof(PollFD));
// Initialize revents to zero to ensure clean state
for (PollFD& pollfd : fds) {
pollfd.revents = PollEvents{};
}
if (timeout >= 0) {
const s64 seconds = timeout / 1000;
const u64 nanoseconds = 1'000'000 * (static_cast<u64>(timeout) % 1000);