forked from dolphin-emu/dolphin
evdev: Fix select() call
It's not guaranteed that the eventfd is smaller than the monitor fd, because fds are not always monotonically allocated. To select() correctly in all cases, use the max between the monitor fd and eventfd.
This commit is contained in:
@@ -72,7 +72,7 @@ static void HotplugThreadFunc()
|
|||||||
FD_SET(monitor_fd, &fds);
|
FD_SET(monitor_fd, &fds);
|
||||||
FD_SET(s_wakeup_eventfd, &fds);
|
FD_SET(s_wakeup_eventfd, &fds);
|
||||||
|
|
||||||
int ret = select(monitor_fd + 1, &fds, nullptr, nullptr, nullptr);
|
int ret = select(std::max(monitor_fd, s_wakeup_eventfd) + 1, &fds, nullptr, nullptr, nullptr);
|
||||||
if (ret < 1 || !FD_ISSET(monitor_fd, &fds))
|
if (ret < 1 || !FD_ISSET(monitor_fd, &fds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user