Skip to content
Snippets Groups Projects
Commit 548c2ede authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Martin KaFai Lau
Browse files

libbpf: fix libbpf_strerror_r() handling unknown errors


strerror_r(), used from libbpf-specific libbpf_strerror_r() wrapper is
documented to return error in two different ways, depending on glibc
version. Take that into account when handling strerror_r()'s own errors,
which happens when we pass some non-standard (internal) kernel error to
it. Before this patch we'd have "ERROR: strerror_r(524)=22", which is
quite confusing. Now for the same situation we'll see a bit less
visually scary "unknown error (-524)".

At least we won't confuse user with irrelevant EINVAL (22).

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240507001335.1445325-5-andrii@kernel.org


Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 9d66d60e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment