[PATCH] bpftool: fix typo in struct_ops map FD generation for light skeleton

From: Siddharth Nayyar

Date: Wed May 20 2026 - 05:46:52 EST


When generating light skeletons for BPF programs containing struct_ops
maps, bpftool incorrectly outputs a stray literal 't' instead of a tab
character for the map file descriptor member in the links structure.
This causes a compilation error when the generated light skeleton is
used.

Correct the format string by replacing 't' with '\t'.

Fixes: 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton")
Signed-off-by: Siddharth Nayyar <sidnayyar@xxxxxxxxxx>
---
tools/bpf/bpftool/gen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index 2f9e10752e28..d6040b52d4e1 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -1399,7 +1399,7 @@ static int do_skeleton(int argc, char **argv)
continue;

if (use_loader)
- printf("t\tint %s_fd;\n", ident);
+ printf("\t\tint %s_fd;\n", ident);
else
printf("\t\tstruct bpf_link *%s;\n", ident);
}

---
base-commit: c6e99c10fd9855082568cbd71bb2cc5dc90eda53
change-id: 20260519-struct_ops_gen_typo_fix-59d53748cece

Best regards,
--
Siddharth Nayyar <sidnayyar@xxxxxxxxxx>