diff --git a/services/core/ability/utils/src/file_utils.cpp b/services/core/ability/utils/src/file_utils.cpp index af7f983bce19dcea00921486e45f87151af6ceae..b3d9f61f530ba12930a0bf978ce1b260b36ae8d0 100644 --- a/services/core/ability/utils/src/file_utils.cpp +++ b/services/core/ability/utils/src/file_utils.cpp @@ -68,15 +68,19 @@ bool FileUtils::IsSpaceEnough(const std::string &filePath, const int64_t require bool FileUtils::SaveDataToFile(const std::string &filePath, const std::string &data) { + char dealPath[PATH_MAX] = {}; + if (realpath(filePath.c_str(), dealPath) == nullptr) { + ENGINE_LOGI("filePath %{private}s is not exist or invalid, error is %{public}d", filePath.c_str(), errno); + } std::ofstream os; - os.open(filePath, std::ios::trunc); + os.open(dealPath, std::ios::trunc); if (os.is_open()) { - ENGINE_LOGI("SaveDataToFile success, file = %{public}s", filePath.c_str()); + ENGINE_LOGI("SaveDataToFile success, file = %{public}s", dealPath); os << data; os.close(); return true; } - ENGINE_LOGE("SaveDataToFile fail, file = %{public}s", filePath.c_str()); + ENGINE_LOGE("SaveDataToFile fail, file = %{public}s", dealPath); os.close(); return false; } diff --git a/services/startup/manage/src/startup_schedule.cpp b/services/startup/manage/src/startup_schedule.cpp index 23db1f565fb239866b9fadaeffc3aa5a5070af0f..70abb24a3e47ed4a21fdf679e63938280e992173 100644 --- a/services/startup/manage/src/startup_schedule.cpp +++ b/services/startup/manage/src/startup_schedule.cpp @@ -42,7 +42,8 @@ void StartupSchedule::RegisterLooper(const ScheduleLooper &looper) { UnregisterLooper(); ENGINE_LOGI("RegisterLooper"); - int64_t startTime = AlarmTimerUtils::GetSystemBootTime() + STARTUP_LOOPER_INTERVAL * Constant::MILLESECONDS; + int64_t startTime = static_cast(AlarmTimerUtils::GetSystemBootTime()) + + static_cast(STARTUP_LOOPER_INTERVAL) * Constant::MILLESECONDS; looperTimerId_ = AlarmTimerUtils::RegisterRepeatAlarm(startTime, STARTUP_LOOPER_INTERVAL, [=]() { looper(); }); }