diff options
| author | Andrii Nakryiko <[email protected]> | 2019-07-01 23:58:55 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2019-07-05 20:37:30 +0000 |
| commit | d66f43666a6811bcc3e529d5a088e1bdde94ca1b (patch) | |
| tree | 28edae2fc3fa048150cf120724f23273e9c24a7c /tools/lib/bpf/str_error.c | |
| parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next (diff) | |
| download | kernel-d66f43666a6811bcc3e529d5a088e1bdde94ca1b.tar.gz kernel-d66f43666a6811bcc3e529d5a088e1bdde94ca1b.zip | |
libbpf: make libbpf_strerror_r agnostic to sign of error
It's often inconvenient to switch sign of error when passing it into
libbpf_strerror_r. It's better for it to handle that automatically.
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Stanislav Fomichev <[email protected]>
Acked-by: Song Liu <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Diffstat (limited to 'tools/lib/bpf/str_error.c')
| -rw-r--r-- | tools/lib/bpf/str_error.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/str_error.c b/tools/lib/bpf/str_error.c index 00e48ac5b806..b8064eedc177 100644 --- a/tools/lib/bpf/str_error.c +++ b/tools/lib/bpf/str_error.c @@ -11,7 +11,7 @@ */ char *libbpf_strerror_r(int err, char *dst, int len) { - int ret = strerror_r(err, dst, len); + int ret = strerror_r(err < 0 ? -err : err, dst, len); if (ret) snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret); return dst; |
