[vlc-devel] [PATCH 1/1] If the target libc lacks strerror_l, fallback to strerror_r.

Richard Diamond wichard at vitalitystudios.com
Sun Mar 13 00:28:19 CET 2016


---
 configure.ac      | 2 +-
 src/posix/error.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index be65881..7a1e04b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -574,7 +574,7 @@ need_libc=false
 
 dnl Check for usual libc functions
 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
-AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock])
+AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock strerror_l])
 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy timegm timespec_get strverscmp])
 AC_REPLACE_FUNCS([gettimeofday])
 AC_CHECK_FUNCS(fdatasync,,
diff --git a/src/posix/error.c b/src/posix/error.c
index db51004..9b996cd 100644
--- a/src/posix/error.c
+++ b/src/posix/error.c
@@ -48,7 +48,11 @@ static const char *vlc_strerror_l(int errnum, const char *lname)
         errno = saved_errno;
     }
 
+#ifdef HAVE_STRERROR_L
     const char *buf = strerror_l(errnum, loc);
+#else
+    const char *buf = strerror_r(errnum, NULL, 0);
+#endif
 
     freelocale(loc);
     return buf;
-- 
2.5.0



More information about the vlc-devel mailing list