From: Zhihao Cheng Date: Wed, 9 Jun 2021 11:59:16 +0000 (+0800) Subject: tools/bpftool: Fix error return code in do_batch() X-Git-Tag: v5.14-rc1~119^2~135^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca16b429f39b4ce013bfa7e197f25681e65a2a42;p=thirdparty%2Fkernel%2Flinux.git tools/bpftool: Fix error return code in do_batch() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 668da745af3c2 ("tools: bpftool: add support for quotations ...") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng Signed-off-by: Andrii Nakryiko Reviewed-by: Quentin Monnet Link: https://lore.kernel.org/bpf/20210609115916.2186872-1-chengzhihao1@huawei.com --- diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 7f2817d97079a..3ddfd48437386 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -341,8 +341,10 @@ static int do_batch(int argc, char **argv) n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines); if (!n_argc) continue; - if (n_argc < 0) + if (n_argc < 0) { + err = n_argc; goto err_close; + } if (json_output) { jsonw_start_object(json_wtr);