remove getting TZ_USER_ICONS path 85/74485/13
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 14 Jun 2016 02:35:01 +0000 (11:35 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Mon, 8 Aug 2016 05:35:31 +0000 (22:35 -0700)
for removing TZ_USER_ICONS

Submit with:
https://review.tizen.org/gerrit/#/c/74482/

Change-Id: I81cd19ccdccddef237514a0081bae11d26d75b63
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
parser/pkgmgr_parser.c
src/pkgmgrinfo_db.c

index c3ea5b3..1d96d0d 100644 (file)
@@ -1345,35 +1345,35 @@ static char *__get_icon_with_path(const char *icon, uid_t uid)
                return strdup(icon);
 
        do {
-               snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
-                               getIconPath(uid, true), icon);
-               if (access(icon_with_path, F_OK) == 0)
-                       break;
+               if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+                       snprintf(icon_with_path, sizeof(icon_with_path),
+                               "%s%s", getIconPath(uid, true), icon);
+                       if (access(icon_with_path, F_OK) == 0)
+                               break;
 
-               snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
-                               getIconPath(uid, false), icon);
-               if (access(icon_with_path, F_OK) == 0)
-                       break;
+                       snprintf(icon_with_path, sizeof(icon_with_path),
+                               "%s%s", getIconPath(uid, false), icon);
+                       if (access(icon_with_path, F_OK) == 0)
+                               break;
 
-               /* for backward compatibility (.../default/small/...)
-                * this should be removed
-                */
-               snprintf(icon_with_path, sizeof(icon_with_path),
+                       /* for backward compatibility (.../default/small/...)
+                        * this should be removed
+                        */
+                       snprintf(icon_with_path, sizeof(icon_with_path),
                                "%sdefault/small/%s",
                                getIconPath(uid, true), icon);
-               if (access(icon_with_path, F_OK) == 0)
-                       break;
+                       if (access(icon_with_path, F_OK) == 0)
+                               break;
 
-               snprintf(icon_with_path, sizeof(icon_with_path),
+                       snprintf(icon_with_path, sizeof(icon_with_path),
                                "%sdefault/small/%s",
                                getIconPath(uid, false), icon);
-               if (access(icon_with_path, F_OK) == 0)
-                       break;
+                       if (access(icon_with_path, F_OK) == 0)
+                               break;
 
-               /* If doesn't exist in case of Global app,
-                * try to get icon directly into app's directory
-                */
-               if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+                       /* If doesn't exist in case of Global app,
+                        * try to get icon directly into app's directory
+                        */
                        app_path = tzplatform_getenv(TZ_SYS_RO_APP);
 
                        snprintf(icon_with_path, sizeof(icon_with_path),
index b92bfa2..58edc27 100644 (file)
@@ -273,17 +273,15 @@ API const char *getIconPath(uid_t uid, bool readonly)
        gid_t gid = ROOT_UID;
 
        if (uid != GLOBAL_USER && uid != ROOT_UID) {
-               tzplatform_set_user(uid);
-               path = tzplatform_mkpath(TZ_USER_ICONS, "/");
-               gid = _get_gid(tzplatform_getenv(TZ_SYS_USER_GROUP));
-               tzplatform_reset_user();
-       } else {
-               if (readonly)
-                       path = tzplatform_mkpath(TZ_SYS_RO_ICONS, "/");
-               else
-                       path = tzplatform_mkpath(TZ_SYS_RW_ICONS, "/");
+               _LOGD("not supported target user");
+               return NULL;
        }
 
+       if (readonly)
+               path = tzplatform_mkpath(TZ_SYS_RO_ICONS, "/");
+       else
+               path = tzplatform_mkpath(TZ_SYS_RW_ICONS, "/");
+
        /* just allow certain users to create the icon directory if needed. */
        if (uid_caller == ROOT_UID || uid_caller == uid)
                _mkdir_for_user(path, uid, gid);