[libdvdnav-devel] [Git][videolan/libdvdread][master] add checks for strerror_r

François Cartegnie gitlab at videolan.org
Thu Mar 5 17:07:44 CET 2020



François Cartegnie pushed to branch master at VideoLAN / libdvdread


Commits:
9bc33de3 by Francois Cartegnie at 2020-03-05T16:58:11+01:00
add checks for strerror_r

- - - - -


2 changed files:

- configure.ac
- src/dvd_input.c


Changes:

=====================================
configure.ac
=====================================
@@ -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()


=====================================
src/dvd_input.c
=====================================
@@ -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);



View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/9bc33de3458560f7069257e7b429fc66f514a4fe

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/9bc33de3458560f7069257e7b429fc66f514a4fe
You're receiving this email because of your account on code.videolan.org.




More information about the libdvdnav-devel mailing list