From c1024854d5c794956e3f843548cdcf6ae6c4640d Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 26 Jan 2016 14:52:11 +0900 Subject: [PATCH] Set executable permission before creating symlink The executable file must get execute permission even if the app type is not 'capp' type. Change-Id: I348016776cc36a3386556cb2c81dcdcfe3bf46ea Signed-off-by: Sangyoon Jang --- src/tpk/step/step_create_symbolic_link.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tpk/step/step_create_symbolic_link.cc b/src/tpk/step/step_create_symbolic_link.cc index 29d73cb..60887df 100644 --- a/src/tpk/step/step_create_symbolic_link.cc +++ b/src/tpk/step/step_create_symbolic_link.cc @@ -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(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(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; -- 2.7.4