2016-12-29 03:53:45 +00:00
|
|
|
https://sourceware.org/bugzilla/show_bug.cgi?id=21002
|
|
|
|
|
2018-06-17 09:08:51 +00:00
|
|
|
--- a/lib/system.h
|
|
|
|
+++ b/lib/system.h
|
2018-09-18 04:07:57 +00:00
|
|
|
@@ -30,7 +30,16 @@
|
2017-05-05 23:05:56 +00:00
|
|
|
#define LIB_SYSTEM_H 1
|
2015-06-14 17:43:40 +00:00
|
|
|
|
2018-09-18 04:07:57 +00:00
|
|
|
#include <errno.h>
|
|
|
|
-#include <error.h>
|
2016-12-29 03:53:45 +00:00
|
|
|
+#ifdef HAVE_ERROR_H
|
|
|
|
+#include "error.h"
|
|
|
|
+#else
|
|
|
|
+#include "err.h"
|
2017-05-05 23:05:56 +00:00
|
|
|
+#include <stdio.h>
|
2016-12-29 03:53:45 +00:00
|
|
|
+#define error(status, errno, ...) \
|
|
|
|
+ fflush(stdout); \
|
|
|
|
+ warn(__VA_ARGS__); \
|
|
|
|
+ if (status) exit(status)
|
2015-06-14 17:43:40 +00:00
|
|
|
+#endif
|
2017-05-05 23:05:56 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/param.h>
|
2018-09-18 04:07:57 +00:00
|
|
|
@@ -38,6 +47,10 @@
|
2017-05-05 23:05:56 +00:00
|
|
|
#include <byteswap.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2016-12-29 03:53:45 +00:00
|
|
|
+#ifndef __GLIBC__
|
|
|
|
+#define canonicalize_file_name(name) realpath(name,NULL)
|
|
|
|
+#endif
|
2017-05-05 23:05:56 +00:00
|
|
|
+
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
# define LE32(n) (n)
|
|
|
|
# define LE64(n) (n)
|
2018-06-17 09:08:51 +00:00
|
|
|
--- a/libdw/libdw_alloc.c
|
|
|
|
+++ b/libdw/libdw_alloc.c
|
2018-09-18 04:07:57 +00:00
|
|
|
@@ -73,5 +73,5 @@ __attribute ((noreturn)) attribute_hidde
|
2015-06-14 17:43:40 +00:00
|
|
|
__libdw_oom (void)
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
- error (EXIT_FAILURE, ENOMEM, "libdw");
|
2016-12-29 03:53:45 +00:00
|
|
|
+ error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
|
2015-06-14 17:43:40 +00:00
|
|
|
}
|
2018-06-17 09:08:51 +00:00
|
|
|
--- a/libdwfl/dwfl_error.c
|
|
|
|
+++ b/libdwfl/dwfl_error.c
|
2015-11-11 08:32:28 +00:00
|
|
|
@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
|
|
|
|
const char *
|
|
|
|
dwfl_errmsg (int error)
|
2015-06-14 17:43:40 +00:00
|
|
|
{
|
|
|
|
+ static __thread char s[64] = "";
|
|
|
|
if (error == 0 || error == -1)
|
|
|
|
{
|
|
|
|
int last_error = global_error;
|
2015-11-11 08:32:28 +00:00
|
|
|
@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
|
2015-06-14 17:43:40 +00:00
|
|
|
switch (error &~ 0xffff)
|
|
|
|
{
|
|
|
|
case OTHER_ERROR (ERRNO):
|
|
|
|
- return strerror_r (error & 0xffff, "bad", 0);
|
|
|
|
+ strerror_r (error & 0xffff, s, sizeof(s));
|
|
|
|
+ return s;
|
|
|
|
case OTHER_ERROR (LIBELF):
|
|
|
|
return elf_errmsg (error & 0xffff);
|
|
|
|
case OTHER_ERROR (LIBDW):
|