diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-30 18:09:14 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-30 18:09:14 +0300 |
commit | 29f79155b9b331167497efb0407de082d8750862 (patch) | |
tree | dde524fa03471f3a6c951e21879f36b7b952a9f8 /tools/lib/bpf/str_error.c | |
parent | 2e32188a66142b5b4c2dbdd6ac8dc6f54361f044 (diff) | |
parent | 17b57b1883c1285f3d0dc2266e8f79286a7bef38 (diff) | |
download | linux-29f79155b9b331167497efb0407de082d8750862.tar.xz |
Merge 4.19-rc6 into usb-next
We want the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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; +} |