summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Lee <stayfan@google.com>2020-01-14 19:42:31 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-01-14 19:42:31 +0100
commitb17cdb26df85edb01fe1d450a55f6fa7a6334345 (patch)
treea2e85595d082191043e291abe033aaccc1cf8031
parentMerge "Add elsk@ to OWNERS" (diff)
parentFix ioctl FIONREAD call parameters to use int instead of size_t (diff)
downloadandroid_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar.gz
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar.bz2
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar.lz
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar.xz
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.tar.zst
android_bootable_recovery-b17cdb26df85edb01fe1d450a55f6fa7a6334345.zip
-rw-r--r--minui/events.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/minui/events.cpp b/minui/events.cpp
index f331ed68a..87f811225 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -90,9 +90,11 @@ static int inotify_cb(int fd, __unused uint32_t epevents) {
// The inotify will put one or several complete events.
// Should not read part of one event.
- size_t event_len;
- int ret = ioctl(fd, FIONREAD, &event_len);
+ int event_len_int;
+ int ret = ioctl(fd, FIONREAD, &event_len_int);
if (ret != 0) return -1;
+ if (event_len_int < 0) return -1;
+ size_t event_len = event_len_int;
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(INPUT_DEV_DIR), closedir);
if (!dir) {