diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2018-10-19 15:24:24 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-10-19 15:24:24 +0200 |
commit | e42b4a507efa19a90c63e7968c93c4f82d3bc805 (patch) | |
tree | cc7bf34323b26d3f53d4a9ec4ca1b5c52bc361cd /tools/lib/bpf/str_error.c | |
parent | 1e58e5e59148916fa43444a406335a990783fb78 (diff) | |
parent | e4e11cc0f81ee7be17d6f6fb96128a6d51c0e838 (diff) |
Merge tag 'kvmarm-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
KVM/arm updates for 4.20
- Improved guest IPA space support (32 to 52 bits)
- RAS event delivery for 32bit
- PMU fixes
- Guest entry hardening
- Various cleanups
Diffstat (limited to 'tools/lib/bpf/str_error.c')
-rw-r--r-- | tools/lib/bpf/str_error.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/lib/bpf/str_error.c b/tools/lib/bpf/str_error.c new file mode 100644 index 000000000000..b8798114a357 --- /dev/null +++ b/tools/lib/bpf/str_error.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: LGPL-2.1 +#undef _GNU_SOURCE +#include <string.h> +#include <stdio.h> +#include "str_error.h" + +/* + * Wrapper to allow for building in non-GNU systems such as Alpine Linux's musl + * libc, while checking strerror_r() return to avoid having to check this in + * all places calling it. + */ +char *str_error(int err, char *dst, int len) +{ + int ret = strerror_r(err, dst, len); + if (ret) + snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret); + return dst; +} |