summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYucong Sun <fallentree@fb.com>2021-09-28 20:42:21 +0200
committerAndrii Nakryiko <andrii@kernel.org>2021-09-29 00:19:22 +0200
commit09710d82c0a3469eadc32781721ac2336fdf915d (patch)
treed5bda672678e1b693a87e3b1347b137be4b0613a /tools
parentMerge branch 'libbpf: stricter BPF program section name handling' (diff)
downloadlinux-09710d82c0a3469eadc32781721ac2336fdf915d.tar.xz
linux-09710d82c0a3469eadc32781721ac2336fdf915d.zip
bpftool: Avoid using "?: " in generated code
"?:" is a GNU C extension, some environment has warning flags for its use, or even prohibit it directly. This patch avoid triggering these problems by simply expand it to its full form, no functionality change. Signed-off-by: Yucong Sun <fallentree@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210928184221.1545079-1-fallentree@fb.com
Diffstat (limited to 'tools')
-rw-r--r--tools/bpf/bpftool/gen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index e3ec47a6a612..cc835859465b 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -803,7 +803,10 @@ static int do_skeleton(int argc, char **argv)
} \n\
\n\
err = %1$s__create_skeleton(obj); \n\
- err = err ?: bpf_object__open_skeleton(obj->skeleton, opts);\n\
+ if (err) \n\
+ goto err_out; \n\
+ \n\
+ err = bpf_object__open_skeleton(obj->skeleton, opts);\n\
if (err) \n\
goto err_out; \n\
\n\