diff options
Diffstat (limited to 'src/system.c')
-rw-r--r-- | src/system.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/system.c b/src/system.c index 76a39ad2..4a70c204 100644 --- a/src/system.c +++ b/src/system.c @@ -27,6 +27,20 @@ #include <stdlib.h> #include <string.h> +int +serd_system_strerror(const int errnum, char* const buf, const size_t buflen) +{ +#if USE_STRERROR_R + return strerror_r(errnum, buf, buflen); + +#else // Not thread-safe, but... oh well? + const char* const message = strerror(errnum); + + strncpy(buf, message, buflen); + return 0; +#endif +} + void* serd_malloc_aligned(const size_t alignment, const size_t size) { |