From 6ea89ed78d344d01de4566ae7cc690c0cfe5673e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 9 Jul 2021 22:29:55 -0400 Subject: Use thread-safe strerror_r() if available --- src/world.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index 916aa869..c3c3660f 100644 --- a/src/world.c +++ b/src/world.c @@ -4,6 +4,7 @@ #include "world.h" #include "serd_config.h" +#include "system.h" #if defined(USE_POSIX_FADVISE) # include @@ -13,18 +14,17 @@ #include #include #include -#include FILE* serd_world_fopen(SerdWorld* world, const char* path, const char* mode) { FILE* fd = fopen(path, mode); if (!fd) { - serd_world_errorf(world, - SERD_BAD_STREAM, - "failed to open file %s (%s)\n", - path, - strerror(errno)); + char message[1024] = {0}; + serd_system_strerror(errno, message, sizeof(message)); + + serd_world_errorf( + world, SERD_BAD_STREAM, "failed to open file %s (%s)\n", path, message); return NULL; } -- cgit v1.2.1