]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
libbpf: preserve errno across pr_warn/pr_info/pr_debug
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 10 Aug 2022 18:34:25 +0000 (11:34 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Aug 2022 18:47:29 +0000 (11:47 -0700)
commitd7c5802faff6e7f50d18db40fdcb7e50590177f5
tree53a459f9da5f0444d3d5260e273c62285c1efff3
parent43caeec90da04de7d5f63c0d3fe37e5425da6b5d
libbpf: preserve errno across pr_warn/pr_info/pr_debug

As suggested in [0], make sure that libbpf_print saves and restored
errno and as such guaranteed that no matter what actual print callback
user installs, macros like pr_warn/pr_info/pr_debug are completely
transparent as far as errno goes.

While libbpf code is pretty careful about not clobbering important errno
values accidentally with pr_warn(), it's a trivial change to make sure
that pr_warn can be used anywhere without a risk of clobbering errno.

No functional changes, just future proofing.

  [0] https://github.com/libbpf/libbpf/pull/536

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Daniel Müller <deso@posteo.net>
Link: https://lore.kernel.org/r/20220810183425.1998735-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c