public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] Check for existence of GNU-style strerror_r
@ 2017-05-04 10:24 Ulf Hermann
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hermann @ 2017-05-04 10:24 UTC (permalink / raw)
  To: elfutils-devel

We cannot get GNU strerror_r from gnulib.

If we don't have it, we don't translate system error codes to strings in
dwfl_error.c.

(rebased on top of all the other patches)

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog            | 4 ++++
 configure.ac         | 2 ++
 libdwfl/ChangeLog    | 5 +++++
 libdwfl/dwfl_error.c | 4 ++++
 4 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 7a40c9d..662c633 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,10 @@
 
 2017-04-21  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Check for strerror_r and its variants.
+
+2017-04-21  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Add check for GNU-style basename.
 
 2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index e55360d..6cbd70d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -456,6 +456,8 @@ char *basename(const char *path);
 #endif
 ])
 
+AC_FUNC_STRERROR_R
+
 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")
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index a7e6e30..26a3599 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -100,6 +100,11 @@
 	the note name data is the empty string.
 	(dwfl_core_file_attach): Likewise.
 
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* dwfl_error.c: If we don't have a strerror_r returning a char*,
+	output a less useful message in case of a system error.
+
 2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* linux-kernel-modules.c: Include system.h.
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
index 7bcf61c..aba3cca 100644
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -154,7 +154,11 @@ dwfl_errmsg (int error)
   switch (error &~ 0xffff)
     {
     case OTHER_ERROR (ERRNO):
+#ifdef STRERROR_R_CHAR_P
       return strerror_r (error & 0xffff, "bad", 0);
+#else
+      return "Unknown error. See errno";
+#endif
     case OTHER_ERROR (LIBELF):
       return elf_errmsg (error & 0xffff);
     case OTHER_ERROR (LIBDW):
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2] Check for existence of GNU-style strerror_r
@ 2017-02-22 15:58 Ulf Hermann
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hermann @ 2017-02-22 15:58 UTC (permalink / raw)
  To: elfutils-devel

If we don't have it, we don't translate system error codes to strings in
dwfl_error.c.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog            | 4 ++++
 configure.ac         | 2 ++
 libdwfl/ChangeLog    | 5 +++++
 libdwfl/dwfl_error.c | 4 ++++
 4 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index dd9b9ac..1acc8ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Check for strerror_r and its variants.
+
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Add check for fputs_unlocked.
 
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index 8119e07..ce40539 100644
--- a/configure.ac
+++ b/configure.ac
@@ -309,6 +309,8 @@ AC_CHECK_DECLS([fputs_unlocked],[],[],
                [#define _GNU_SOURCE
                 #include <stdio.h>])
 
+AC_FUNC_STRERROR_R
+
 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")
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index f5921dc..1a23136 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* dwfl_error.c: If we don't have a strerror_r returning a char*,
+	output a less useful message in case of a system error.
+
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* dwfl_module_getsrc_file.c: Include system.h.
 
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
index 7bcf61c..aba3cca 100644
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -154,7 +154,11 @@ dwfl_errmsg (int error)
   switch (error &~ 0xffff)
     {
     case OTHER_ERROR (ERRNO):
+#ifdef STRERROR_R_CHAR_P
       return strerror_r (error & 0xffff, "bad", 0);
+#else
+      return "Unknown error. See errno";
+#endif
     case OTHER_ERROR (LIBELF):
       return elf_errmsg (error & 0xffff);
     case OTHER_ERROR (LIBDW):
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-04  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 10:24 [PATCH v2] Check for existence of GNU-style strerror_r Ulf Hermann
  -- strict thread matches above, loose matches on Subject: below --
2017-02-22 15:58 Ulf Hermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).