fix setting a default font issue in wrong cases 26/108526/1 accepted/tizen/3.0/common/20170126.092531 accepted/tizen/3.0/ivi/20170126.060956 accepted/tizen/3.0/mobile/20170126.060708 accepted/tizen/3.0/tv/20170126.060853 submit/tizen_3.0/20170125.120130 submit/tizen_3.0/20170125.121642
authorYoungbok Shin <youngb.shin@samsung.com>
Thu, 5 Jan 2017 03:39:57 +0000 (12:39 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Thu, 5 Jan 2017 03:39:57 +0000 (12:39 +0900)
Even if a deleted font is not related to current font,
The download font service changes current font to a default font in some cases.
It is caused by using strncmp without "/" character at end of delete dir path.

ex. Current Font Path - /opt/share/fonts/org.tizen.downloadablefont1/myfont.ttf
    Delete Font Path  - /opt/share/fonts/org.tizen.downloadablefont

The path for comparing should have "/" at end of the path.

Change-Id: I76bbd3b06a835edb987093f4ee3226c2eb0c01ac

pkgmgr_font/src/font_service_register.c

index 55f072f..726a57c 100755 (executable)
@@ -633,7 +633,7 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
        pkgmgrinfo_pkginfo_h handle = NULL;
        const char* app_root_path = NULL;
        const char *dest_path = NULL;
-       int ret;
+       int ret, deletedir_len;
        uid_t uid = 0;
 
        elm_init(0, NULL);
@@ -668,10 +668,12 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                goto FAIL;
        }
 
-       sprintf(deletedir,"%s/%s", dest_path, appid);
+       /* It must contain "/" character at end of the delete dir path.
+        * It prevents file path comparing issues when there are many similar path. */
+       sprintf(deletedir,"%s/%s/", dest_path, appid);
 
        //check if current using font is same with uninstall font
-       int deletedir_len = strlen(deletedir);
+       deletedir_len = strlen(deletedir);
 
        pat = FcPatternCreate();
        if (pat == NULL)