#include <fontconfig/fontconfig.h>
#include <Elementary.h>
#include <pkgmgr-info.h>
+#include <pkgmgr_installer_info.h>
#include "system_settings.h"
static const char *ELM_PROFILE_CFG = "/opt/home/app/.elementary/config/profile.cfg";
#define MAX_FILE_LEN 4096
-#define APP_OWNER_ID 5000
-#define APP_GROUP_ID 5000
+#define APP_OWNER_ID 5001
+#define APP_GROUP_ID 100
static int make_dir(const char *path);
static int symbolic_link(const char *srcpath, const char *destpath);
return ret;
}
- ret = chmod (path, 0755);
+ ret = chown(path, getuid(), APP_GROUP_ID);
+ if (ret < 0)
+ {
+ DEBUG_ERROR("chown is failed %s\n",path);
+ return ret;
+ }
+
+ ret = chmod(path, 0755);
if (ret < 0)
{
DEBUG_ERROR("chmod is failed %s\n",path);
return ret;
}
}
- ret = lsetxattr(path, "security.SMACK64", "_", 1, 0);
-
- if (ret < 0)
- {
- DEBUG_ERROR("lsetxattr is failed %s\n",path);
- return ret;
- }
return ret;
}
DEBUG_ERROR("symlink is failed \n");
goto FAIL;
}
-
- ret = lsetxattr(destdir, "security.SMACK64", "_", 1, 0);
-
- if (ret < 0)
- {
- DEBUG_ERROR("lsetxattr is failed %s\n",destdir);
- goto FAIL;
- }
}
}
closedir (d);
DEBUG_ERROR("symlink is failed \n");
goto FAIL;
}
-
- ret = lsetxattr(destdir, "security.SMACK64", "_", 1, 0);
-
- if (ret < 0)
- {
- DEBUG_ERROR("lsetxattr is failed %s\n",destdir);
- goto FAIL;
- }
}
}
closedir (d);
pkgmgrinfo_pkginfo_h handle = NULL;
const char *app_root_path = NULL;
const char *dest_path = NULL;
+ uid_t uid = 0;
+
+ pkgmgr_installer_info_get_target_uid(&uid);
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret < 0)
{
DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
pkgmgrinfo_pkginfo_h handle = NULL;
const char* app_root_path = NULL;
const char* dest_path = NULL;
+ uid_t uid = 0;
+
+ pkgmgr_installer_info_get_target_uid(&uid);
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret < 0)
{
DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
if (access(deletedir, F_OK) == -1)
{
- DEBUG_ERROR("dest directory is not exist \n");
+ DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno));
goto FAIL;
}
}
ret = make_dir(PARENT_PATH);
-
if (ret < 0)
{
- DEBUG_ERROR("make current directory is failed \n");
+ DEBUG_ERROR("make current directory(%s) is failed: %s\n", PARENT_PATH, strerror(errno));
goto FAIL;
}
ret = make_dir(dest_path);
-
if (ret < 0)
{
- DEBUG_ERROR("make current directory is failed \n");
+ DEBUG_ERROR("make current directory(%s) is failed: %s\n", dest_path, strerror(errno));
goto FAIL;
}
FcObjectSet *os = NULL;
FcPattern *pat = NULL;
FcFontSet *fs = NULL;
+ pkgmgrinfo_pkginfo_h handle = NULL;
const char* app_root_path = NULL;
const char *dest_path = NULL;
int ret;
+ uid_t uid = 0;
elm_init(0, NULL);
return -1;
}
- pkgmgrinfo_pkginfo_h handle = NULL;
-
+ pkgmgr_installer_info_get_target_uid(&uid);
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret < 0)
{
DEBUG_ERROR("pkgid[%s] handle get fail", pkgid);
chmod (ELM_PROFILE_CFG, 0777);
}
- ret = lsetxattr(ELM_PROFILE_CFG, "security.SMACK64", "system::homedir", 15, 0);
- if (ret < 0)
- {
- chmod (ELM_PROFILE_CFG, 0777);
- }
-
- DIR *d;
+ DIR *d = NULL;
struct dirent *e;
- d = opendir (elm_profile_path);
+ if (elm_profile_path)
+ d = opendir (elm_profile_path);
- while ((e = readdir (d)))
+ if (d)
{
- if (e->d_name[0] != '.' && (strstr(e->d_name, ".cfg") != 0 || strstr(e->d_name, ".CFG") != 0))
+ while ((e = readdir (d)))
{
- char file_full_path[100];
-
- sprintf(file_full_path, "%s/%s", elm_profile_path, e->d_name);
-
- ret = chown(file_full_path, APP_OWNER_ID, APP_GROUP_ID);
- if (ret < 0)
+ if (e->d_name[0] != '.' && (strstr(e->d_name, ".cfg") != 0 || strstr(e->d_name, ".CFG") != 0))
{
- DEBUG_LOG("chown is failed %s", file_full_path);
- chmod (file_full_path, 0777);
- }
+ char file_full_path[100];
- ret = lsetxattr(file_full_path, "security.SMACK64", "system::homedir", 15, 0);
- if (ret < 0)
- {
- DEBUG_LOG("chsmack is failed %s", file_full_path);
- chmod (file_full_path, 0777);
+ sprintf(file_full_path, "%s/%s", elm_profile_path, e->d_name);
+
+ ret = chown(file_full_path, APP_OWNER_ID, APP_GROUP_ID);
+ if (ret < 0)
+ {
+ DEBUG_LOG("chown is failed %s", file_full_path);
+ chmod (file_full_path, 0777);
+ }
}
}
- }
- closedir (d);
+ closedir (d);
+ }
free(default_font_name);
free(elm_profile_path);
if (access(deletedir, F_OK) == -1)
{
- DEBUG_ERROR("dest directory(%s) is not exist \n", deletedir);
+ DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno));
goto FAIL;
}