From: Hwankyu Jhun Date: Fri, 3 Apr 2020 04:40:16 +0000 (+0900) Subject: Fix appmanager tool X-Git-Tag: submit/tizen/20200408.034535~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edcd69b8f0fa0d4478069abe3956f489b0d4bfa7;p=platform%2Fcore%2Fapi%2Fapp-manager.git Fix appmanager tool - Checks the return values Change-Id: I769e9acec6313ce1c7f2b4b8d60705c4810e969c Signed-off-by: Hwankyu Jhun --- diff --git a/tool/main.c b/tool/main.c index 9a8ef55..f6db8cf 100644 --- a/tool/main.c +++ b/tool/main.c @@ -49,14 +49,38 @@ static int _get_appinfo(const char *app_id) ret = app_manager_get_app_info(app_id, &app_info); if (ret != APP_MANAGER_ERROR_NONE) { fprintf(stderr, "No corresponding app_id for [%s]\n", app_id); - return APP_MANAGER_ERROR_NO_SUCH_APP; + return ret; } - app_info_get_app_id(app_info, &appid); - app_info_get_label(app_info, &label); - app_info_get_icon(app_info, &icon); - app_info_get_package(app_info, &package); - app_info_get_type(app_info, &type); + ret = app_info_get_app_id(app_info, &appid); + if (ret != APP_MANAGER_ERROR_NONE) { + fprintf(stderr, "Failed to get app_id. error(%d)\n", ret); + goto end; + } + + ret = app_info_get_label(app_info, &label); + if (ret != APP_MANAGER_ERROR_NONE) { + fprintf(stderr, "Failed to get label. error(%d)\n", ret); + goto end; + } + + ret = app_info_get_icon(app_info, &icon); + if (ret != APP_MANAGER_ERROR_NONE) { + fprintf(stderr, "Failed to get icon. error(%d)\n", ret); + goto end; + } + + ret = app_info_get_package(app_info, &package); + if (ret != APP_MANAGER_ERROR_NONE) { + fprintf(stderr, "Failed to get package. error(%d)\n", ret); + goto end; + } + + ret = app_info_get_type(app_info, &type); + if (ret != APP_MANAGER_ERROR_NONE) { + fprintf(stderr, "Failed to get type. error(%d)\n", ret); + goto end; + } fprintf(stderr, "appid = [%s]\n", appid); fprintf(stderr, "label = [%s]\n", label); @@ -64,17 +88,16 @@ static int _get_appinfo(const char *app_id) fprintf(stderr, "package = [%s]\n", package); fprintf(stderr, "type = [%s]\n", type); - ret = app_info_destroy(app_info); - if (ret != APP_MANAGER_ERROR_NONE) - return APP_MANAGER_ERROR_IO_ERROR; - +end: free(appid); free(label); free(icon); free(package); free(type); - return APP_MANAGER_ERROR_NONE; + app_info_destroy(app_info); + + return ret; } int main(int argc, char **argv)