!594 fix: Alarm cleaning

Merge pull request !594 from jiangwei/master
This commit is contained in:
openharmony_ci 2024-09-25 08:20:01 +00:00 committed by Gitee
commit 5c0d84eeaa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -1266,7 +1266,6 @@ void SetCmdTraceIntParams(const std::string &traceParamsStr, int &traceParams)
if (traceParams <= 0) {
HILOG_WARN(LOG_CORE, "Illegal input, traceParams initialized to null.");
traceParams = 0;
return;
}
}

View File

@ -153,8 +153,9 @@ void DelSnapshotTraceFile(const bool deleteSavedFmt, const int keepFileCount)
return a.ctime < b.ctime;
});
int deleteFileCnt = snapshotTraceFiles.size() - keepFileCount;
for (int i = 0; i < deleteFileCnt && i < snapshotTraceFiles.size(); i++) {
int snapshotTraceFilesSize = static_cast<int>(snapshotTraceFiles.size());
int deleteFileCnt = snapshotTraceFilesSize - keepFileCount;
for (int i = 0; i < deleteFileCnt && i < snapshotTraceFilesSize; i++) {
RemoveFile(TRACE_DEFAULT_DIR + snapshotTraceFiles[i].filename);
}
}