summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-02-04 22:45:28 +0100
committerLéo Lam <leo@innovatetechnologi.es>2018-02-04 22:45:28 +0100
commit9a3705f82dbf30d9706e8a0b76fc6164cf3ba4af (patch)
tree63e006130eba281344feee2ed4bbed26ca38a062 /Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
parent51d3de67876db960e7bef815d724c47f9b45db20 (diff)
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.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index 85e4973270..398d33eb78 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -72,7 +72,7 @@ static void HotplugThreadFunc()
FD_SET(monitor_fd, &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))
continue;