Fixed bug checking internet privilege for each app (#447)
[platform/core/dotnet/launcher.git] / 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);