diff mbox series

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

Message ID 20210609115916.2186872-1-chengzhihao1@huawei.com
State New
Headers show
Series tools/bpftool: Fix error return code in do_batch() | expand

Commit Message

Zhihao Cheng June 9, 2021, 11:59 a.m. UTC
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 <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 tools/bpf/bpftool/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andrii Nakryiko June 15, 2021, 6:23 a.m. UTC | #1
On Wed, Jun 9, 2021 at 6:34 AM Quentin Monnet <quentin@isovalent.com> wrote:
>

> 2021-06-09 19:59 UTC+0800 ~ Zhihao Cheng <chengzhihao1@huawei.com>

> > 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 <hulkci@huawei.com>

> > Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>

>

> Reviewed-by: Quentin Monnet <quentin@isovalent.com>

>

> Thank you for the fix.


This has been applied to bpf-next last Friday. Patchbot missed it.

> Quentin
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 7f2817d97079..3ddfd4843738 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);