From 7a031103c709005f413637b7afafa1e693f26d69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=B5=9C=EC=A2=85=ED=97=8C/Common=20Platform=20Lab=28SR=29?= =?utf8?q?/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 8 Jul 2020 17:55:37 +0900 Subject: [PATCH] Modification of lchown for ni file in .tac_symlink (#258) Change-Id: I09594fae53d991f49161da4b96e8b3b7ee2f598e --- NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc | 2 +- NativeLauncher/tool/tac_common.cc | 4 ++-- NativeLauncher/util/utils.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc index 2d77a80..71d5dd1 100644 --- a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc @@ -135,7 +135,7 @@ static int compareSHA256Info(std::string sha256Info, std::string nugetPackage) static int copyNCreateSymlink(std::string binPath, std::string tacVersionDir, std::string nugetPackage, bool isCreateTacDir) { uid_t g_uid = 0; - gid_t g_gid = 0; + const gid_t g_gid = 0; if (pkgmgr_installer_info_get_target_uid(&g_uid) < 0) { _ERR("Failed to get UID"); return -1; diff --git a/NativeLauncher/tool/tac_common.cc b/NativeLauncher/tool/tac_common.cc index a982b26..75c636b 100644 --- a/NativeLauncher/tool/tac_common.cc +++ b/NativeLauncher/tool/tac_common.cc @@ -179,8 +179,8 @@ tac_error_e restoreTACDB() tac_db = NULL; } - uid_t g_uid = 301; // app_fw - gid_t g_gid = 301; // app_fw + const uid_t g_uid = 301; // app_fw + const gid_t g_gid = 301; // app_fw if (!copyFile(TAC_APP_LIST_RESTORE_DB, TAC_APP_LIST_DB)) { fprintf(stderr, "Failed to copy of %s\n", TAC_APP_LIST_DB); diff --git a/NativeLauncher/util/utils.cc b/NativeLauncher/util/utils.cc index 90fd0e4..ac43df8 100644 --- a/NativeLauncher/util/utils.cc +++ b/NativeLauncher/util/utils.cc @@ -391,7 +391,7 @@ void copySmackAndOwnership(const std::string& fromPath, const std::string& toPat } // change owner and groups for symbolic link. - if (!stat(fromPath.c_str(), &info)) { + if (!lstat(fromPath.c_str(), &info)) { if (lchown(toPath.c_str(), info.st_uid, info.st_gid) == -1) fprintf(stderr, "Failed to change owner and group name\n"); } -- 2.7.4