Fix InstallerRunner::Run() 69/229869/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 6 Apr 2020 06:57:33 +0000 (15:57 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 9 Apr 2020 03:43:25 +0000 (12:43 +0900)
When Undo() fails 2nd installer or later, the returned result should be
UNDO_ERROR.

Change-Id: I1cda23a4656d710888ed7e1e8372607e9a78d5ee
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/installer_runner.cc

index c9e45ca..063e788 100644 (file)
@@ -30,14 +30,15 @@ AppInstaller::Result InstallerRunner::Run() {
   }
   if (it != installers_.end() && result == AppInstaller::Result::ERROR) {
     do {
-      if ((*it)->Undo() != AppInstaller::Result::OK)
+      AppInstaller::Result ret = (*it)->Undo();
+      if (ret != AppInstaller::Result::OK && ret != AppInstaller::Result::ERROR)
         result = AppInstaller::Result::UNDO_ERROR;
     } while (it-- != installers_.begin());
   } else {
     --it;
     do {
-      if ((*it)->Clean() != AppInstaller::Result::OK)
-        result = AppInstaller::Result::CLEANUP_ERROR;
+      // Clean operation always succeeds
+      (*it)->Clean();
     } while (it-- != installers_.begin());
   }