Skip to content
Snippets Groups Projects
Commit 9bc33de3 authored by François Cartegnie's avatar François Cartegnie :fingers_crossed:
Browse files

add checks for strerror_r

parent 32afabc1
No related branches found
No related tags found
1 merge request!12add checks for strerror_r
Pipeline #14532 passed with stage
in 1 minute and 54 seconds
......@@ -115,6 +115,9 @@ AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
AC_DEFINE([UNUSED], [], [Unused parameter annotation])
])
AC_FUNC_STRERROR_R
AS_IF([test "x$ac_cv_func_strerror_r" = "xyes"], [], [AC_CHECK_FUNCS([strerror_s])])
dnl export library version number
DVDREAD_VERSION_MAJOR=dvdread_major()
DVDREAD_VERSION_MINOR=dvdread_minor()
......
......@@ -200,8 +200,23 @@ static dvd_input_t file_open(void *priv, dvd_logger_cb *logcb,
#endif
if(dev->fd < 0) {
char buf[256];
#if defined(HAVE_STRERROR_R) && defined(HAVE_DECL_STRERROR_R)
#ifdef STRERROR_R_CHAR_P
*buf=0;
if(strerror_r(errno, buf, 256) == NULL)
*buf=0;
#else
if(strerror_r(errno, buf, 256) != 0)
*buf=0;
#endif
#else
#if defined(HAVE_STRERR_S)
if(strerror_s(errno, buf, 256) != 0)
*buf=0;
#else
*buf=0;
#endif
#endif
DVDReadLog(priv, logcb, DVD_LOGGER_LEVEL_ERROR,
"Could not open input: %s", buf);
free(dev);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment