Modification of lchown for ni file in .tac_symlink (#258)
author최종헌/Common Platform Lab(SR)/Engineer/삼성전자 <j-h.choi@samsung.com>
Wed, 8 Jul 2020 08:55:37 +0000 (17:55 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Wed, 8 Jul 2020 08:55:37 +0000 (17:55 +0900)
Change-Id: I09594fae53d991f49161da4b96e8b3b7ee2f598e

NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
NativeLauncher/tool/tac_common.cc
NativeLauncher/util/utils.cc

index 2d77a80c872a0c0190a88d026be98a594c2ff3bd..71d5dd13a2ef47ffcc351f301856510796a71b09 100644 (file)
@@ -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;
index a982b267703a4fe14e2b699120f436afefdc1abc..75c636b5dc7f8a669e7391a844dc718e9b5c2ee7 100644 (file)
@@ -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);
index 90fd0e432a0227703dd89081a641c0fc4fd37b10..ac43df89c165c2cce9b3a7cb10a344e13c98cc0c 100644 (file)
@@ -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");
                }