summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Yi <byi@google.com>2022-01-07 03:27:54 +0100
committerBill Yi <byi@google.com>2022-01-07 03:27:54 +0100
commitf368b1564b8b98dc2ece39a369916fd5212e8e6e (patch)
treeb1264f802260ccf7cba9d16a198b26121376c6e5
parentMerge "Fix wrong key indexes in package verification logs." (diff)
parentMerge cherrypicks of [16034933] into sc-qpr1-release. (diff)
downloadandroid_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar.gz
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar.bz2
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar.lz
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar.xz
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.tar.zst
android_bootable_recovery-f368b1564b8b98dc2ece39a369916fd5212e8e6e.zip
Diffstat (limited to '')
-rw-r--r--minui/events.cpp8
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;
}