[glib/3v1n0/strerror_r-int-variant-support: 1/3] gbacktrace: Handle case of strerror_r returning an int value
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/3v1n0/strerror_r-int-variant-support: 1/3] gbacktrace: Handle case of strerror_r returning an int value
- Date: Wed, 6 Jul 2022 22:44:04 +0000 (UTC)
commit 640e586251380ee8768c01118db56d2a42557693
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Wed Jul 6 23:45:39 2022 +0200
gbacktrace: Handle case of strerror_r returning an int value
As it's the case in FreeBSD and Mac OS X.
glib/gbacktrace.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c
index ae4bdec0c7..6f4604e1fd 100644
--- a/glib/gbacktrace.c
+++ b/glib/gbacktrace.c
@@ -323,8 +323,13 @@ stack_trace_sigchld (int signum)
static inline const char *
get_strerror (char *buffer, gsize n)
{
-#ifdef HAVE_STRERROR_R
+#if defined(STRERROR_R_CHAR_P)
return strerror_r (errno, buffer, n);
+#elif defined(HAVE_STRERROR_R)
+ int ret = strerror_r (errno, buffer, n);
+ if (ret == 0 || ret == EINVAL)
+ return buffer;
+ return NULL;
#else
const char *error_str = strerror (errno);
if (!error_str)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]