Make ScopedAppLauncher child always notify the parent 54/231254/15
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 20 Apr 2020 13:18:10 +0000 (15:18 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 29 Apr 2020 18:50:57 +0000 (20:50 +0200)
In case any of ScopedAppLauncher child process asserts fails, make sure the
parent is notified and displays the error properly.

Change-Id: I75bbe0e7781cf338b62a39de03fda8f305ae8d50

src/security-manager-tests/common/scoped_app_launcher.cpp

index a557f01..50a9587 100644 (file)
@@ -34,11 +34,15 @@ ScopedAppLauncher::ScopedAppLauncher(const AppInstallHelper& app) :
     } else {
         m_syncPipe.claimChildEp();
 
-        RUNNER_ASSERT_ERRNO_MSG(setLauncherSecurityAttributes(app.getUID(), app.getGID()) == 0,
-                                "launcher failed");
-        Api::prepareAppCandidate();
-        Api::prepareApp(app.getAppId().c_str());
-
+        try {
+            RUNNER_ASSERT_ERRNO_MSG(setLauncherSecurityAttributes(app.getUID(), app.getGID()) == 0,
+                                    "launcher failed");
+            Api::prepareAppCandidate();
+            Api::prepareApp(app.getAppId().c_str());
+        } catch (...) {
+            m_syncPipe.post();
+            throw;
+        }
         m_syncPipe.post();
         m_syncPipe.wait();
         exit(0);