Change recovery files priority 42/235242/2
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 3 Jun 2020 04:17:53 +0000 (13:17 +0900)
committerilho kim <ilho159.kim@samsung.com>
Mon, 8 Jun 2020 23:48:46 +0000 (23:48 +0000)
If there are a recovery file with backup, backup file is used for recovery

Change-Id: Iaf6bf7a8b46e7279a6e71ab7aa864d2106557a34
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/pkg_recovery/pkg_recovery.cc

index 18a3448a81ff71da0191649c44099696c8b86277..a2a187b5f4d7a9ade69e611cda8b7c9644a5b021 100644 (file)
@@ -140,9 +140,8 @@ void PkgRecoveryService::SearchBackupFiles(uid_t uid) {
       if (std::regex_search(file, match, backup_regex)) {
         bf::path orig_file(iter->path().parent_path() / iter->path().stem());
         if (bf::exists(orig_file))
-          bf::remove(iter->path());
-        else
-          bf::rename(iter->path(), orig_file);
+          bf::remove(orig_file);
+        bf::rename(iter->path(), orig_file);
       }
     } catch (...) {
       LOG(WARNING) << "Exception occurred: "