diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-13 01:00:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-13 01:00:32 +0000 |
commit | 018409c52745d12c969c5fed49cdbe2cd7bbe3dd (patch) | |
tree | d29110f02a00665a9296772627d02f532c5ff41b | |
parent | 76eeeea93884a621bf90927437b64fc5867a9abd (diff) | |
parent | 22a72a73c7bcf5c5487b8e6d0d1e429f84e62387 (diff) | |
download | recovery-android12-qpr1-d-s2-release.tar.gz |
Snap for 7817723 from 22a72a73c7bcf5c5487b8e6d0d1e429f84e62387 to sc-qpr1-d-releaseandroid-12.0.0_r32android-12.0.0_r29android-12.0.0_r27android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-release
Change-Id: I0964ea8d0ce3ff681c5c70cd9a0899f1fab90173
-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 87f81122..863ac747 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; } |