From: Junghyun Yeon Date: Thu, 30 Nov 2017 07:27:39 +0000 (+0900) Subject: Integrate recovery file creation and first write procedure X-Git-Tag: submit/tizen/20171208.083756~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21dc7f731cfa8e47d66ecd51299586c7d485aadc;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Integrate recovery file creation and first write procedure - Recovery file creation process is separated with file creation and type write processes. - Integrate those two processes into one. Change-Id: I9c5e0b192c8f35d7a612e58417bed1d9468bfd87 Signed-off-by: Junghyun Yeon --- diff --git a/src/common/recovery_file.cc b/src/common/recovery_file.cc index af8f55e7..966c06f2 100644 --- a/src/common/recovery_file.cc +++ b/src/common/recovery_file.cc @@ -92,12 +92,10 @@ RecoveryFile::RecoveryFile(const bf::path& path, RequestType type, bool load) } } else { // create file - FILE* handle = fopen(path.c_str(), "w"); - if (!handle) { + if (!WriteAndCommitFileContent()) { path_.clear(); return; } - fclose(handle); LOG(DEBUG) << "Recovery file " << path_ << " created"; } } diff --git a/src/common/step/recovery/step_create_recovery_file.cc b/src/common/step/recovery/step_create_recovery_file.cc index e743537c..51d89c3f 100644 --- a/src/common/step/recovery/step_create_recovery_file.cc +++ b/src/common/step/recovery/step_create_recovery_file.cc @@ -38,12 +38,6 @@ Step::Status StepCreateRecoveryFile::process() { LOG(ERROR) << "Failed to create recovery file"; return Status::CONFIG_ERROR; } - recovery_file->set_type(context_->request_type.get()); - - if (!recovery_file->WriteAndCommitFileContent()) { - LOG(ERROR) << "Failed to write recovery file"; - return Status::CONFIG_ERROR; - } context_->recovery_info.set(RecoveryInfo(std::move(recovery_file))); return Status::OK;