Skip to content

Commit 4654f1f

Browse files
Zhihao Chenggregkh
authored andcommitted
tools/bpftool: Fix error return code in do_batch()
[ Upstream commit ca16b42 ] Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 668da74 ("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>
1 parent 1ccbb55 commit 4654f1f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tools/bpf/bpftool/main.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ static int do_batch(int argc, char **argv)
338338
n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines);
339339
if (!n_argc)
340340
continue;
341-
if (n_argc < 0)
341+
if (n_argc < 0) {
342+
err = n_argc;
342343
goto err_close;
344+
}
343345

344346
if (json_output) {
345347
jsonw_start_object(json_wtr);

0 commit comments

Comments
 (0)