tools/bpftool: Fix error return code in do_batch()

[ Upstream commit ca16b429f39b4ce013bfa7e197f25681e65a2a42 ]

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 668da745af ("tools: bpftool: add support for quotations ...")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20210609115916.2186872-1-chengzhihao1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Zhihao Cheng 2021-06-09 19:59:16 +08:00 committed by Greg Kroah-Hartman
parent fe5cca1057
commit 5f54370530

View File

@ -303,8 +303,10 @@ static int do_batch(int argc, char **argv)
n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines); n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines);
if (!n_argc) if (!n_argc)
continue; continue;
if (n_argc < 0) if (n_argc < 0) {
err = n_argc;
goto err_close; goto err_close;
}
if (json_output) { if (json_output) {
jsonw_start_object(json_wtr); jsonw_start_object(json_wtr);