Merge sc-qpr1 to aosp-master - DO NOT MERGE

Merged-In: I15f31c6b5cb5975d25199a3e9a0d6e22afcf0bd4
Merged-In: I7cff12b3c0b96c818b7e121d2e9038d49aad9886
Change-Id: If7d4e210285bbd21e5f4f2ab4533e16776425c71
This commit is contained in:
Bill Yi 2022-01-06 18:27:54 -08:00
commit f368b1564b

View file

@ -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;
}