aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/config.in3
-rwxr-xr-xgdb/configure2
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/config.in3
-rwxr-xr-xgdb/gdbserver/configure2
-rw-r--r--gdb/gdbsupport/common.m42
-rw-r--r--gdb/gdbsupport/posix-strerror.c28
8 files changed, 26 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 134c883d823..0f92504269d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-11-15 Christian Biesinger <cbiesinger@google.com>
+
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * gdbsupport/common.m4: No longer check for strerror_r.
+ * gdbsupport/posix-strerror.c (safe_strerror): Always call the
+ POSIX version of strerror_r, now that gnulib provides it if
+ necessary.
+
2019-11-14 Christian Biesinger <cbiesinger@google.com>
* README (`configure' options): Update.
diff --git a/gdb/config.in b/gdb/config.in
index 5a21fca9814..fc05f154b72 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -423,9 +423,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strerror_r' function. */
-#undef HAVE_STRERROR_R
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
diff --git a/gdb/configure b/gdb/configure
index 512f0162ff2..e8059039bd5 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -13480,7 +13480,7 @@ done
for ac_func in fdwalk getrlimit pipe pipe2 socketpair sigaction \
- sigprocmask strerror_r
+ sigprocmask
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index e17a7ca461e..0f0fc0384dd 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-15 Christian Biesinger <cbiesinger@google.com>
+
+ * config.in: Regenerate.
+ * configure: Regenerate.
+
2019-11-12 Andrew Burgess <andrew.burgess@embecosm.com>
* ax.c (ax_printf): Handle size_t_arg.
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 2984281cee5..0bce18d2a0e 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -229,9 +229,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strerror_r' function. */
-#undef HAVE_STRERROR_R
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 3f1f1c19ba4..e513fc5eb10 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -6822,7 +6822,7 @@ done
for ac_func in fdwalk getrlimit pipe pipe2 socketpair sigaction \
- sigprocmask strerror_r
+ sigprocmask
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gdb/gdbsupport/common.m4 b/gdb/gdbsupport/common.m4
index 2e44cf45368..471d7056f74 100644
--- a/gdb/gdbsupport/common.m4
+++ b/gdb/gdbsupport/common.m4
@@ -33,7 +33,7 @@ AC_DEFUN([GDB_AC_COMMON], [
dlfcn.h)
AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair sigaction \
- sigprocmask strerror_r])
+ sigprocmask])
AC_CHECK_DECLS([strerror, strstr])
diff --git a/gdb/gdbsupport/posix-strerror.c b/gdb/gdbsupport/posix-strerror.c
index 34420cf5377..107813fa3fd 100644
--- a/gdb/gdbsupport/posix-strerror.c
+++ b/gdb/gdbsupport/posix-strerror.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
+#include <string.h>
/* Implementation of safe_strerror as defined in common-utils.h. */
@@ -26,23 +27,12 @@ safe_strerror (int errnum)
{
static thread_local char buf[1024];
- char *msg = nullptr;
-#ifdef HAVE_STRERROR_R
-# if !__GLIBC__ || ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE)
- /* Glibc has two different, incompatible versions of strerror_r. */
- if (strerror_r (errnum, buf, sizeof (buf)) == 0)
- msg = buf;
-# else
- msg = strerror_r (errnum, buf, sizeof (buf));
-# endif
-#else
- msg = strerror (errnum);
-#endif
- if (msg == nullptr)
- {
-
- xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
- msg = buf;
- }
- return (msg);
+ /* Assign the return value to an int, so we get an error if we accidentally
+ get the wrong version of this function (glibc has two of them...). */
+ int ret = strerror_r (errnum, buf, sizeof (buf));
+ if (ret == 0)
+ return buf;
+
+ xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
+ return buf;
}