From b3cd5ab4c010ee637f9c6d07460471c6246b7a49 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 18 Feb 2022 12:51:03 +0200 Subject: cli: use UBUS_STATUS_PARSE_ERROR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the newly introduced UBUS_STATUS_PARSE_ERROR status message in ubus_cli_call() and ubus_cli_send(). Signed-off-by: Stijn Tintel Acked-by: Petr Štetiar Acked-by: Jo-Philipp Wich --- cli.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cli.c b/cli.c index 81591ec..3b67047 100644 --- a/cli.c +++ b/cli.c @@ -142,9 +142,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int argc, char **argv) blob_buf_init(&b, 0); if (argc == 3 && !blobmsg_add_json_from_string(&b, argv[2])) { - if (!simple_output) - fprintf(stderr, "Failed to parse message data\n"); - return -1; + return UBUS_STATUS_PARSE_ERROR; } ret = ubus_lookup_id(ctx, argv[0], &id); @@ -268,9 +266,7 @@ static int ubus_cli_send(struct ubus_context *ctx, int argc, char **argv) blob_buf_init(&b, 0); if (argc == 2 && !blobmsg_add_json_from_string(&b, argv[1])) { - if (!simple_output) - fprintf(stderr, "Failed to parse message data\n"); - return -1; + return UBUS_STATUS_PARSE_ERROR; } return ubus_send_event(ctx, argv[0], b.head); -- cgit v1.2.1