From 549eb42c5cae8b7ce12787da961cd8100a0ffa9f Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Fri, 2 Dec 2016 22:02:40 +0900 Subject: [PATCH] if it's failed to get the pkgtype from the file, use the pkgtype argument. Change-Id: I8deaf21a552e94007e5a1c7b9341dcb69ccfe0d5 Signed-off-by: jongmyeongko --- src/request.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/request.c b/src/request.c index d8e034a..f7c10fb 100644 --- a/src/request.c +++ b/src/request.c @@ -21,6 +21,7 @@ static const char instropection_xml[] = " " " " " " + " " " " " " " " @@ -34,6 +35,7 @@ static const char instropection_xml[] = " " " " " " + " " " " " " " " @@ -278,6 +280,7 @@ static int __handle_request_install(uid_t caller_uid, GDBusMethodInvocation *invocation, GVariant *parameters) { uid_t target_uid = (uid_t)-1; + char *arg_pkgtype = NULL; const char *pkgtype; char *pkgpath = NULL; char *args = NULL; @@ -289,7 +292,8 @@ static int __handle_request_install(uid_t caller_uid, int i = 0; int len = 0; - g_variant_get(parameters, "(u&s@as)", &target_uid, &pkgpath, &value); + g_variant_get(parameters, "(u&s&s@as)", &target_uid, &arg_pkgtype, + &pkgpath, &value); tmp_args = (gchar **)g_variant_get_strv(value, &args_count); for (i = 0; i < args_count; i++) @@ -318,6 +322,8 @@ static int __handle_request_install(uid_t caller_uid, } pkgtype = _get_pkgtype_from_file(pkgpath); + if (!pkgtype && arg_pkgtype) + pkgtype = (const char *)arg_pkgtype; if (pkgtype == NULL) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(is)", PKGMGR_R_ECOMM, "")); @@ -363,6 +369,7 @@ static int __handle_request_mount_install(uid_t caller_uid, GDBusMethodInvocation *invocation, GVariant *parameters) { uid_t target_uid = (uid_t)-1; + char *arg_pkgtype = NULL; const char *pkgtype; char *pkgpath = NULL; char *args = NULL; @@ -374,7 +381,8 @@ static int __handle_request_mount_install(uid_t caller_uid, int i = 0; int len = 0; - g_variant_get(parameters, "(u&s@as)", &target_uid, &pkgpath, &value); + g_variant_get(parameters, "(u&s&s@as)", &target_uid, &arg_pkgtype, + &pkgpath, &value); tmp_args = (gchar **)g_variant_get_strv(value, &args_count); for (i = 0; i < args_count; i++) @@ -403,6 +411,8 @@ static int __handle_request_mount_install(uid_t caller_uid, } pkgtype = _get_pkgtype_from_file(pkgpath); + if (!pkgtype && arg_pkgtype) + pkgtype = (const char *)arg_pkgtype; if (pkgtype == NULL) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(is)", PKGMGR_R_ECOMM, "")); -- 2.7.4