libbpf: Prevent overriding errno when logging errors
authorToke Høiland-Jørgensen <toke@redhat.com>
Thu, 13 Aug 2020 14:29:05 +0000 (16:29 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 13 Aug 2020 20:30:31 +0000 (22:30 +0200)
commit23ab656be263813acc3c20623757d3cd1496d9e1
treed06549aeba7a768fb50051dde65d3d8fb616fb56
parentb33164f2bd1cedb094c32cb466287116164457ae
libbpf: Prevent overriding errno when logging errors

Turns out there were a few more instances where libbpf didn't save the
errno before writing an error message, causing errno to be overridden by
the printf() return and the error disappearing if logging is enabled.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200813142905.160381-1-toke@redhat.com
tools/lib/bpf/libbpf.c