aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-12-16 00:07:40 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-12-16 00:07:40 +0000
commitbbbf8ec392f9bc0f10ee08dea25826ccb589ac09 (patch)
treed29110f02a00665a9296772627d02f532c5ff41b
parent1751842dc1ca17f9f05dd0af92d544b7b0f8147a (diff)
parentacfa50aa8e6f28e566193f4799dc9f1488f8c1a5 (diff)
downloadrecovery-android-platform-12.0.0_r19.tar.gz
Change-Id: Id8e6e2cfb6cd5217202285425cced1f0d798854e
-rw-r--r--minui/events.cpp8
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;
}