Set executable permission before creating symlink 26/57926/1 submit/devel/ivi/20160203.005039 submit/tizen/20160126.100658
authorSangyoon Jang <s89.jang@samsung.com>
Tue, 26 Jan 2016 05:52:11 +0000 (14:52 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Tue, 26 Jan 2016 05:52:11 +0000 (14:52 +0900)
The executable file must get execute permission even if the app type is
not 'capp' type.

Change-Id: I348016776cc36a3386556cb2c81dcdcfe3bf46ea
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/tpk/step/step_create_symbolic_link.cc

index 29d73cb7e14f3de90fb6725389097e4ae0ea0d13..60887df99d804618180ebb5558d07e90b2eefb8d 100644 (file)
@@ -44,6 +44,11 @@ bool CreateSymLink(application_x* app, InstallerContext* context) {
     return false;
   }
 
+  return true;
+}
+
+bool SetExecPermission(application_x* app) {
+  boost::system::error_code boost_error;
   // Give an execution permission to the original executable
   LOG(DEBUG) << "Giving exec permission to " << app->exec;
   bf::permissions(bf::path(app->exec), bf::owner_all |
@@ -53,6 +58,7 @@ bool CreateSymLink(application_x* app, InstallerContext* context) {
     LOG(ERROR) << "Permission change failure";
     return false;
   }
+
   return true;
 }
 
@@ -75,6 +81,8 @@ Status StepCreateSymbolicLink::precheck() {
 Status StepCreateSymbolicLink::process() {
   manifest_x* m = context_->manifest_data.get();
   for (application_x* app : GListRange<application_x*>(m->application)) {
+    if (!SetExecPermission(app))
+      return Status::ERROR;
     // filter out non-tpk apps as this step is run for hybrid backend too
     if (strcmp("capp", app->type) != 0)
       continue;
@@ -89,6 +97,8 @@ Status StepCreateSymbolicLink::undo() {
   manifest_x* m = context_->manifest_data.get();
   Step::Status ret = Status::OK;
   for (application_x* app : GListRange<application_x*>(m->application)) {
+    if (!SetExecPermission(app))
+      return Status::ERROR;
     // filter out non-tpk apps as this step is run for hybrid backend too
     if (strcmp("capp", app->type) != 0)
       continue;