forked from Qortal/Brooklyn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
636 B
21 lines
636 B
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) |
|
#undef _GNU_SOURCE |
|
#include <string.h> |
|
#include <stdio.h> |
|
#include "str_error.h" |
|
|
|
/* make sure libbpf doesn't use kernel-only integer typedefs */ |
|
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 |
|
|
|
/* |
|
* 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 *libbpf_strerror_r(int err, char *dst, int 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; |
|
}
|
|
|