From 7f8da82a9509102d45cab252b3babc28bca988e2 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Thu, 16 Jun 2016 14:05:01 +0900 Subject: [PATCH] Fix to handle invalid package type input parameter as an error Change-Id: I99f28e2f3648b64f680c3d6bf571bd5fe4924217 Signed-off-by: Yunjin Lee --- src/privilege_info.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/privilege_info.c b/src/privilege_info.c index 2233b01..5406c20 100755 --- a/src/privilege_info.c +++ b/src/privilege_info.c @@ -323,7 +323,9 @@ int privilege_info_get_display_name_by_pkgtype(const const char* package_type, c ret = privilege_info_get_display_name_string_id_by_pkgtype(package_type, api_version, privilege, &display_name_string_id); - if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { + if (ret == PRVINFO_ERROR_INVALID_PARAMETER) { + return ret; + } else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { char* tempPrivilege = NULL; char* token = NULL; char* temp = NULL; @@ -433,7 +435,9 @@ int privilege_info_get_description_by_pkgtype(const char* package_type, const ch ret = privilege_info_get_description_string_id_by_pkgtype(package_type, api_version, privilege, &description_string_id); - if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { + if (ret == PRVINFO_ERROR_INVALID_PARAMETER) { + return ret; + } else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { char* temp = NULL; temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED"); *description = (char*)calloc(strlen(temp) + 1, sizeof(char)); -- 2.7.4