aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-09 22:29:55 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:07 -0500
commit6ea89ed78d344d01de4566ae7cc690c0cfe5673e (patch)
tree98f856a191ab2d7609f249aeb0fa3b3e1c1e340e /src/world.c
parent1a95f759fe3d642e8520e41e691e63f22a2f3b99 (diff)
downloadserd-6ea89ed78d344d01de4566ae7cc690c0cfe5673e.tar.gz
serd-6ea89ed78d344d01de4566ae7cc690c0cfe5673e.tar.bz2
serd-6ea89ed78d344d01de4566ae7cc690c0cfe5673e.zip
Use thread-safe strerror_r() if available
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c12
1 files changed, 6 insertions, 6 deletions
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 <fcntl.h>
@@ -13,18 +14,17 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
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;
}