Fix StepUpdateTep's undo 82/286482/2
authorilho kim <ilho159.kim@samsung.com>
Mon, 9 Jan 2023 02:49:49 +0000 (11:49 +0900)
committerilho kim <ilho159.kim@samsung.com>
Mon, 9 Jan 2023 10:17:19 +0000 (10:17 +0000)
If there is no tep before updating
the tep directory itself must be removed at undo

Change-Id: I6b8e395c9f7f7758d5eb85f38cd4cbdae12fb5c0
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
src/common/step/filesystem/step_update_tep.cc

index d8ad9cf..41b5117 100644 (file)
@@ -85,7 +85,9 @@ Step::Status StepUpdateTep::clean() {
 }
 
 Step::Status StepUpdateTep::undo() {
-  RemoveAll(context_->tep_path.get());
+  const bf::path& remove_path = context_->tep_path.get();
+  RemoveAll(context_->old_manifest_data.get()->tep_name ?
+      remove_path : remove_path.parent_path());
   return Status::OK;
 }