Fixed bug checking internet privilege for each app (#447)
author최종헌/Common Platform Lab(SR)/삼성전자 <j-h.choi@samsung.com>
Mon, 28 Nov 2022 01:54:39 +0000 (10:54 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 28 Nov 2022 01:54:39 +0000 (10:54 +0900)
Change-Id: Id7491a7e5156a30583caa48db273ecdedf9f56af

NativeLauncher/tool/privilege_common.cc

index 04314bf..737a971 100644 (file)
 #include "launcher_env.h"
 
 static const char* INTERNET_PRIVILEGE = "http://tizen.org/privilege/internet";
-bool isInternetPrivilegeExisted = false;
 
 static int checkInternetPrivilegeCb(const char *privilegeName, void *user_data)
 {
+       bool* ret = (bool*)user_data;
        if (!strcmp(privilegeName, INTERNET_PRIVILEGE)) {
-               isInternetPrivilegeExisted = true;
+               *ret = true;
                return -1;
        }
        return 0;
@@ -33,13 +33,14 @@ static int checkInternetPrivilegeCb(const char *privilegeName, void *user_data)
 
 void checkInternetPrivilegeAndDisableIPv6(const char* pkgId, const std::string& rootPath)
 {
+       bool isInternetPrivilegeExisted = false;
        pkgmgrinfo_pkginfo_h pkg_handle;
        int ret = pkgmgrGetPkgInfo(pkgId, &pkg_handle);
        if (ret != 0) {
                return;
        }
 
-       ret = pkgmgrinfo_pkginfo_foreach_privilege(pkg_handle, checkInternetPrivilegeCb, NULL);
+       ret = pkgmgrinfo_pkginfo_foreach_privilege(pkg_handle, checkInternetPrivilegeCb, &isInternetPrivilegeExisted);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to pkgmgrinfo_pkginfo_foreach_privilege");
                pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_handle);