+2021-02-01 Érico Nogueira <ericonr@disroot.org>
+
+ * configure.ac: Check for GNU strerror_r.
+
2021-01-12 Dmitry V. Levin <ldv@altlinux.org>
* configure.ac [--enable-gcov]: Check for gcov, lcov, and genhtml.
AC_CHECK_FUNCS([process_vm_readv])
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+AC_FUNC_STRERROR_R()
+CFLAGS="$old_CFLAGS"
+
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
+2021-02-01 Érico Nogueira <ericonr@disroot.org>
+
+ * dwfl_error.c (strerror_r): Only use the GNU version when available.
+
2021-01-08 Timm Bäder <tbaeder@redhat.com>
* elf-from-memory.c (elf_from_remote_memory): Add for loop over
}
+static const char *
+errnomsg(int error)
+{
+ /* Won't be changed by strerror_r, but not const so compiler doesn't throw warning */
+ static char unknown[] = "unknown error";
+
+#ifdef STRERROR_R_CHAR_P
+ return strerror_r (error, unknown, 0);
+#else
+ /* To store the error message from strerror_r in a thread-safe manner */
+ static __thread char msg[128];
+ return strerror_r (error, msg, sizeof (msg)) ? unknown : msg;
+#endif
+}
+
const char *
dwfl_errmsg (int error)
{
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
- return strerror_r (error & 0xffff, "bad", 0);
+ return errnomsg (error & 0xffff);
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):