Add codes for backup directory at recovery 27/140827/4
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 26 Jul 2017 11:57:23 +0000 (20:57 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 31 Jul 2017 03:02:24 +0000 (03:02 +0000)
- Directories which have .bck postfix will be removed
  when recovery requests

Change-Id: I6c4571fe5fe5fa45906a5e7aa9f6bd8a9d7ee781
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/step/filesystem/step_remove_temporary_directory.cc
src/common/utils/file_util.cc

index 0de81c8..acf759b 100644 (file)
@@ -25,13 +25,17 @@ Step::Status StepRemoveTemporaryDirectory::RecoveryNew() {
 Step::Status StepRemoveTemporaryDirectory::RemoveFiles() {
   bf::path unpack_dir_path = context_->unpacked_dir_path.get();
   bf::path patch_dir_path = unpack_dir_path;
+  bf::path mount_dir_path = unpack_dir_path;
   patch_dir_path += ".patch";
+  mount_dir_path += ".bck";
   if (unpack_dir_path.empty())
     return Step::Status::OK;
   if (!RemoveAll(unpack_dir_path))
     return Step::Status::RECOVERY_ERROR;
   if (!RemoveAll(patch_dir_path))
     return Step::Status::RECOVERY_ERROR;
+  if (!RemoveAll(mount_dir_path))
+    return Step::Status::RECOVERY_ERROR;
   return Step::Status::OK;
 }
 
index 7741ae8..f9a70b7 100644 (file)
@@ -523,7 +523,7 @@ bool ExtractToTmpDir(const char* zip_path, const bf::path& tmp_dir,
       }
 
       if (!is_directory(filename_in_zip_path)) {
-        FILE *out = fopen(raw_file_name_in_zip, "wbx");
+        FILEout = fopen(raw_file_name_in_zip, "wbx");
         if (!out) {
           LOG(ERROR) << "Failed to open destination ";
           return false;