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>2022-01-13 23:03:49 -0500
commitcc03e614b22b5695a1bbe0bedebd1bf0cf284bf7 (patch)
treee77be535c4dae3c9edade87492e0d0a297d62c9a /src/world.c
parentbf4f881c2241fa8ae6459bd9c8ee6cc83ee563a9 (diff)
downloadserd-cc03e614b22b5695a1bbe0bedebd1bf0cf284bf7.tar.gz
serd-cc03e614b22b5695a1bbe0bedebd1bf0cf284bf7.tar.bz2
serd-cc03e614b22b5695a1bbe0bedebd1bf0cf284bf7.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 71fd32c8..e14a04c9 100644
--- a/src/world.c
+++ b/src/world.c
@@ -17,6 +17,7 @@
#include "world.h"
#include "serd_config.h"
+#include "system.h"
#if defined(USE_POSIX_FADVISE)
# include <fcntl.h>
@@ -26,18 +27,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_ERR_INTERNAL,
- "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_ERR_INTERNAL, "failed to open file %s (%s)\n", path, message);
return NULL;
}