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 2d77a80..71d5dd1 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 a982b26..75c636b 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 90fd0e4..ac43df8 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");
                }