From 4f5f8d67b5f042a9c9bb1e77fe85231fa9d4a0fe Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Fri, 2 Dec 2016 22:04:58 +0900 Subject: [PATCH] if it's failed to get the pkgtype from the file, use the pkgtype argument. Change-Id: Ib4f3d460a10b221253afd8bdb7c2772399225729 Signed-off-by: jongmyeongko --- client/src/pkgmgr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index 73aae94..6894306 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -454,6 +454,7 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type, GVariantBuilder *builder = NULL; GVariant *args = NULL; struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc; + char *pkgtype; struct cb_info *cb_info; if (pc == NULL || pkg_path == NULL) { @@ -476,6 +477,9 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type, return PKGMGR_R_EINVAL; } + if (pkg_type) + pkgtype = strdup(pkg_type); + /* build arguments */ builder = g_variant_builder_new(G_VARIANT_TYPE("as")); if (client->tep_path) { @@ -491,7 +495,8 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type, g_variant_builder_unref(builder); ret = pkgmgr_client_connection_send_request(client, "install", - g_variant_new("(us@as)", uid, pkg_path, args), &result); + g_variant_new("(uss@as)", uid, pkgtype, pkg_path, args), + &result); if (ret != PKGMGR_R_OK) { ERR("request failed: %d", ret); return ret; @@ -605,6 +610,7 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type, GVariantBuilder *builder = NULL; GVariant *args = NULL; struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc; + char *pkgtype; struct cb_info *cb_info; if (pc == NULL || pkg_path == NULL) { @@ -627,6 +633,9 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type, return PKGMGR_R_EINVAL; } + if (pkg_type) + pkgtype = strdup(pkg_type); + /* build arguments */ builder = g_variant_builder_new(G_VARIANT_TYPE("as")); if (client->tep_path) { @@ -642,7 +651,8 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type, g_variant_builder_unref(builder); ret = pkgmgr_client_connection_send_request(client, "mount_install", - g_variant_new("(us@as)", uid, pkg_path, args), &result); + g_variant_new("(uss@as)", uid, pkgtype, pkg_path, args), + &result); if (ret != PKGMGR_R_OK) { ERR("request failed: %d", ret); return ret; -- 2.34.1