Merge "Fix a race condition on ReportHandler::mBatch" into rvc-dev

This commit is contained in:
Mike Ma
2020-03-31 01:04:29 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 1 deletions

View File

@@ -152,6 +152,7 @@ void ReportHandler::handleMessage(const Message& message) {
}
void ReportHandler::schedulePersistedReport(const IncidentReportArgs& args) {
unique_lock<mutex> lock(mLock);
mBatch->addPersistedReport(args);
mHandlerLooper->removeMessages(this, WHAT_TAKE_REPORT);
mHandlerLooper->sendMessage(this, Message(WHAT_TAKE_REPORT));
@@ -159,6 +160,7 @@ void ReportHandler::schedulePersistedReport(const IncidentReportArgs& args) {
void ReportHandler::scheduleStreamingReport(const IncidentReportArgs& args,
const sp<IIncidentReportStatusListener>& listener, int streamFd) {
unique_lock<mutex> lock(mLock);
mBatch->addStreamingReport(args, listener, streamFd);
mHandlerLooper->removeMessages(this, WHAT_TAKE_REPORT);
mHandlerLooper->sendMessage(this, Message(WHAT_TAKE_REPORT));

View File

@@ -755,7 +755,7 @@ status_t TombstoneSection::BlockingCall(unique_fd& pipeWriteFd) const {
if (stat(link_name, &fileStat) != OK) {
continue;
}
size_t exe_name_len = readlink(link_name, exe_name, EXE_NAME_LEN);
ssize_t exe_name_len = readlink(link_name, exe_name, EXE_NAME_LEN);
if (exe_name_len < 0 || exe_name_len >= EXE_NAME_LEN) {
ALOGE("[%s] Can't read '%s': %s", name.string(), link_name, strerror(errno));
continue;