From: Sangyoon Jang Date: Tue, 20 Nov 2018 02:05:22 +0000 (+0900) Subject: Fix __get_path_from_db X-Git-Tag: accepted/tizen/unified/20181122.060320~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F193336%2F3;p=platform%2Fcore%2Fappfw%2Faul-1.git Fix __get_path_from_db If appid is not given, get appid from current pid. Change-Id: Ie902a6855b3a9cb991640a86babf923df4e709e2 Signed-off-by: Sangyoon Jang --- diff --git a/src/aul_path.c b/src/aul_path.c index c7c8ea1..127144a 100644 --- a/src/aul_path.c +++ b/src/aul_path.c @@ -165,6 +165,7 @@ static int __get_path_from_db(char **path, const char *appid, const char *dir_na { char *_path; char buf[PATH_MAX]; + char appid_buf[NAME_MAX]; int ret; pkgmgrinfo_appinfo_h appinfo; int len; @@ -180,7 +181,17 @@ static int __get_path_from_db(char **path, const char *appid, const char *dir_na return AUL_R_OK; } - ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &appinfo); + if (appid == NULL) { + ret = aul_app_get_appid_bypid(getpid(), appid_buf, + sizeof(appid_buf)); + if (ret != AUL_R_OK) { + _E("appid is not given and failed to get appid"); + return ret; + } + } + + ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid ? appid : appid_buf, uid, + &appinfo); if (ret != PMINFO_R_OK) { _E("Failed to get appinfo. (ret:%d)", ret); return AUL_R_ENOAPP;