cli: use UBUS_STATUS_PARSE_ERROR
Use the newly introduced UBUS_STATUS_PARSE_ERROR status message in ubus_cli_call() and ubus_cli_send(). Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be> Acked-by: Petr Štetiar <ynezz@true.cz> Acked-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
66baa44b8d
commit
b3cd5ab4c0
1 changed files with 2 additions and 6 deletions
8
cli.c
8
cli.c
|
@ -142,9 +142,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int argc, char **argv)
|
||||||
|
|
||||||
blob_buf_init(&b, 0);
|
blob_buf_init(&b, 0);
|
||||||
if (argc == 3 && !blobmsg_add_json_from_string(&b, argv[2])) {
|
if (argc == 3 && !blobmsg_add_json_from_string(&b, argv[2])) {
|
||||||
if (!simple_output)
|
return UBUS_STATUS_PARSE_ERROR;
|
||||||
fprintf(stderr, "Failed to parse message data\n");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ubus_lookup_id(ctx, argv[0], &id);
|
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);
|
blob_buf_init(&b, 0);
|
||||||
|
|
||||||
if (argc == 2 && !blobmsg_add_json_from_string(&b, argv[1])) {
|
if (argc == 2 && !blobmsg_add_json_from_string(&b, argv[1])) {
|
||||||
if (!simple_output)
|
return UBUS_STATUS_PARSE_ERROR;
|
||||||
fprintf(stderr, "Failed to parse message data\n");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ubus_send_event(ctx, argv[0], b.head);
|
return ubus_send_event(ctx, argv[0], b.head);
|
||||||
|
|
Loading…
Reference in a new issue