summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/parse_data_structs.py
diff options
context:
space:
mode:
authorYuan Chen <chenyuan_fl@163.com>2026-08-24 17:26:56 +0800
committerAndrii Nakryiko <andrii@kernel.org>2026-08-27 17:07:07 -0700
commit713c02b59e21840f623a3e31c43d967026c75181 (patch)
tree0811568e72d7933bebf7b3963d18b3e6438b97fe /tools/lib/python/kdoc/parse_data_structs.py
parent48b69cc8825d411a4c4df32de854434e9235a1b0 (diff)
downloadlinux-next-713c02b59e21840f623a3e31c43d967026c75181.tar.gz
linux-next-713c02b59e21840f623a3e31c43d967026c75181.zip
bpftool: Fix spurious batch file read error
do_batch() checks errno after the read loop to detect read failures, but fgets() does not clear errno on success, so a stale errno left by a previously executed command (e.g. map dump's EBADF from a double close) makes bpftool report a batch file read failure and exit with an error even though every command succeeded. Clear errno before each fgets() call, so the post-loop check only sees the outcome of the last read: zero on success or EOF, E2BIG for an overlong line, and a genuine errno when fgets() fails. Since errno is now reset before every read in batch mode, drop the USE_LIBCAP errno reset in main() that existed only to keep errno clean for the batch mode. Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool") Signed-off-by: Yuan Chen <chenyuan@kylinos.cn> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260824092657.1789956-2-chenyuan_fl@163.com
Diffstat (limited to 'tools/lib/python/kdoc/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions