1 https://sourceware.org/bugzilla/show_bug.cgi?id=21002
15 +#define error(status, errno, ...) \
17 + warn(__VA_ARGS__); \
18 + if (status) exit(status)
23 #include <sys/param.h>
29 +#define canonicalize_file_name(name) realpath(name,NULL)
32 #if __BYTE_ORDER == __LITTLE_ENDIAN
50 /* Prototype for option handler. */
51 static error_t parse_opt (int key, char *arg, struct argp_state *state);
100 #include <inttypes.h>
116 #include <byteswap.h>
121 #include <inttypes.h>
122 --- a/src/findtextrel.c
123 +++ b/src/findtextrel.c
141 #include <inttypes.h>
150 #include <inttypes.h>
171 #include <inttypes.h>
181 #include <inttypes.h>
190 #include <inttypes.h>
201 #include <inttypes.h>
206 #include <byteswap.h>
222 --- a/tests/addrscopes.c
223 +++ b/tests/addrscopes.c
225 #include <stdio_ext.h>
232 --- a/tests/allregs.c
233 +++ b/tests/allregs.c
242 --- a/tests/backtrace.c
243 +++ b/tests/backtrace.c
252 --- a/tests/backtrace-data.c
253 +++ b/tests/backtrace-data.c
261 #if defined(__x86_64__) && defined(__linux__)
262 --- a/tests/buildid.c
263 +++ b/tests/buildid.c
265 #include ELFUTILS_HEADER(elf)
266 #include ELFUTILS_HEADER(dwelf)
271 #include <sys/types.h>
272 --- a/tests/debugaltlink.c
273 +++ b/tests/debugaltlink.c
275 #include ELFUTILS_HEADER(dw)
276 #include ELFUTILS_HEADER(dwelf)
281 #include <sys/types.h>
282 --- a/tests/debuglink.c
283 +++ b/tests/debuglink.c
286 #include ELFUTILS_HEADER(dwelf)
291 #include <sys/types.h>
292 --- a/tests/dwfl-addr-sect.c
293 +++ b/tests/dwfl-addr-sect.c
295 #include <stdio_ext.h>
301 #include ELFUTILS_HEADER(dwfl)
302 --- a/tests/dwfl-bug-addr-overflow.c
303 +++ b/tests/dwfl-bug-addr-overflow.c
305 #include <inttypes.h>
307 #include <stdio_ext.h>
310 #include ELFUTILS_HEADER(dwfl)
312 --- a/tests/dwfl-bug-fd-leak.c
313 +++ b/tests/dwfl-bug-fd-leak.c
322 --- a/tests/dwfl-bug-getmodules.c
323 +++ b/tests/dwfl-bug-getmodules.c
326 #include ELFUTILS_HEADER(dwfl)
330 static const Dwfl_Callbacks callbacks =
332 --- a/tests/dwfllines.c
333 +++ b/tests/dwfllines.c
341 main (int argc, char *argv[])
342 --- a/tests/dwflmodtest.c
343 +++ b/tests/dwflmodtest.c
345 #include <stdio_ext.h>
351 #include ELFUTILS_HEADER(dwfl)
352 --- a/tests/dwfl-report-elf-align.c
353 +++ b/tests/dwfl-report-elf-align.c
355 #include <inttypes.h>
357 #include <stdio_ext.h>
362 --- a/tests/dwflsyms.c
363 +++ b/tests/dwflsyms.c
366 #include <stdio_ext.h>
372 --- a/tests/early-offscn.c
373 +++ b/tests/early-offscn.c
392 --- a/tests/find-prologues.c
393 +++ b/tests/find-prologues.c
395 #include <stdio_ext.h>
402 --- a/tests/funcretval.c
403 +++ b/tests/funcretval.c
405 #include <stdio_ext.h>
412 --- a/tests/funcscopes.c
413 +++ b/tests/funcscopes.c
415 #include <stdio_ext.h>
422 --- a/tests/line2addr.c
423 +++ b/tests/line2addr.c
432 --- a/tests/low_high_pc.c
433 +++ b/tests/low_high_pc.c
435 #include <stdio_ext.h>
442 --- a/tests/rdwrmmap.c
443 +++ b/tests/rdwrmmap.c
462 --- a/tests/sectiondump.c
463 +++ b/tests/sectiondump.c
471 #include <inttypes.h>
472 --- a/tests/varlocs.c
473 +++ b/tests/varlocs.c
480 #include <sys/types.h>
481 #include <sys/stat.h>
482 --- a/libasm/asm_end.c
483 +++ b/libasm/asm_end.c
492 --- a/libasm/asm_newscn.c
493 +++ b/libasm/asm_newscn.c
502 --- a/libcpu/i386_gendis.c
503 +++ b/libcpu/i386_gendis.c
512 --- a/libcpu/i386_lex.c
513 +++ b/libcpu/i386_lex.c
514 @@ -808,7 +808,6 @@ char *yytext;
522 --- a/libcpu/i386_lex.l
523 +++ b/libcpu/i386_lex.l
532 --- a/libcpu/i386_parse.c
533 +++ b/libcpu/i386_parse.c
539 #include <inttypes.h>
542 --- a/libdw/libdw_alloc.c
543 +++ b/libdw/libdw_alloc.c
552 @@ -74,5 +73,5 @@ __attribute ((noreturn)) attribute_hidde
556 - error (EXIT_FAILURE, ENOMEM, "libdw");
557 + error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
559 --- a/libebl/eblopenbackend.c
560 +++ b/libebl/eblopenbackend.c
569 --- a/libdwfl/dwfl_error.c
570 +++ b/libdwfl/dwfl_error.c
571 @@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
573 dwfl_errmsg (int error)
575 + static __thread char s[64] = "";
576 if (error == 0 || error == -1)
578 int last_error = global_error;
579 @@ -154,7 +155,8 @@ dwfl_errmsg (int error)
580 switch (error &~ 0xffff)
582 case OTHER_ERROR (ERRNO):
583 - return strerror_r (error & 0xffff, "bad", 0);
584 + strerror_r (error & 0xffff, s, sizeof(s));
586 case OTHER_ERROR (LIBELF):
587 return elf_errmsg (error & 0xffff);
588 case OTHER_ERROR (LIBDW):