diff options
author | Christopher Ferris <cferris@google.com> | 2021-10-08 21:05:31 +0200 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-11-25 00:20:28 +0100 |
commit | f0a760b3a154ad328c682ec8559287befff14945 (patch) | |
tree | d29110f02a00665a9296772627d02f532c5ff41b /minui | |
parent | Snap for 7651304 from 76eeeea93884a621bf90927437b64fc5867a9abd to sc-qpr1-release (diff) | |
download | android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar.gz android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar.bz2 android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar.lz android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar.xz android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.tar.zst android_bootable_recovery-f0a760b3a154ad328c682ec8559287befff14945.zip |
Diffstat (limited to 'minui')
-rw-r--r-- | minui/events.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/minui/events.cpp b/minui/events.cpp index 87f811225..863ac7474 100644 --- a/minui/events.cpp +++ b/minui/events.cpp @@ -29,7 +29,9 @@ #include <functional> #include <memory> +#include <string> +#include <android-base/strings.h> #include <android-base/unique_fd.h> #include "minui/minui.h" @@ -118,12 +120,12 @@ static int inotify_cb(int fd, __unused uint32_t epevents) { } offset += sizeof(inotify_event) + pevent->len; - pevent->name[pevent->len] = '\0'; - if (strncmp(pevent->name, "event", 5)) { + std::string event_name(pevent->name, pevent->len); + if (!android::base::StartsWith(event_name, "event")) { continue; } - android::base::unique_fd dfd(openat(dirfd(dir.get()), pevent->name, O_RDONLY)); + android::base::unique_fd dfd(openat(dirfd(dir.get()), event_name.c_str(), O_RDONLY)); if (dfd == -1) { break; } |