aboutsummaryrefslogtreecommitdiffstats
path: root/main/elfutils/musl-strerror_r.patch
blob: 72977951d5484e3dfc681587866816c53372acdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- a/libdwfl/dwfl_error.c	2015-09-29 17:18:51.000000000 +0200
+++ b/libdwfl/dwfl_error.c	2015-11-20 05:11:29.889002058 +0100
@@ -154,7 +154,16 @@
   switch (error &~ 0xffff)
     {
     case OTHER_ERROR (ERRNO):
+#if defined(__GLIBC__)
       return strerror_r (error & 0xffff, "bad", 0);
+#else
+      {
+        static __thread char buf[128] = "";
+        if (0 == strerror_r(error & 0xffff, buf, sizeof(buf)))
+          return buf;
+      }
+      return "strerror_r() failed";
+#endif
     case OTHER_ERROR (LIBELF):
       return elf_errmsg (error & 0xffff);
     case OTHER_ERROR (LIBDW):