3 @@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t
5 #define gettext_noop(Str) Str
7 +#ifndef TEMP_FAILURE_RETRY
8 +#define TEMP_FAILURE_RETRY(expression) \
10 + ({ long int __result; \
11 + do __result = (long int) (expression); \
12 + while (__result == -1L && errno == EINTR); \
16 +#define error(status, errno, ...) err(status, __VA_ARGS__)
18 static inline ssize_t __attribute__ ((unused))
19 pwrite_retry (int fd, const void *buf, size_t len, off_t off)
101 #include <byteswap.h>
107 #include <inttypes.h>
108 --- a/src/findtextrel.c
109 +++ b/src/findtextrel.c
129 #include <inttypes.h>
139 #include <inttypes.h>
162 #include <inttypes.h>
173 #include <inttypes.h>
183 #include <inttypes.h>
195 #include <inttypes.h>
200 #include <byteswap.h>
218 --- a/tests/addrscopes.c
219 +++ b/tests/addrscopes.c
221 #include <stdio_ext.h>
229 --- a/tests/allregs.c
230 +++ b/tests/allregs.c
240 --- a/tests/backtrace.c
241 +++ b/tests/backtrace.c
251 --- a/tests/backtrace-data.c
252 +++ 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)
272 #include <sys/types.h>
273 --- a/tests/debugaltlink.c
274 +++ b/tests/debugaltlink.c
276 #include ELFUTILS_HEADER(dw)
277 #include ELFUTILS_HEADER(dwelf)
283 #include <sys/types.h>
284 --- a/tests/debuglink.c
285 +++ b/tests/debuglink.c
288 #include ELFUTILS_HEADER(dwelf)
294 #include <sys/types.h>
295 --- a/tests/dwfl-addr-sect.c
296 +++ b/tests/dwfl-addr-sect.c
298 #include <stdio_ext.h>
305 #include ELFUTILS_HEADER(dwfl)
306 --- a/tests/dwfl-bug-addr-overflow.c
307 +++ b/tests/dwfl-bug-addr-overflow.c
309 #include <inttypes.h>
311 #include <stdio_ext.h>
315 #include ELFUTILS_HEADER(dwfl)
317 --- a/tests/dwfl-bug-fd-leak.c
318 +++ b/tests/dwfl-bug-fd-leak.c
328 --- a/tests/dwfl-bug-getmodules.c
329 +++ b/tests/dwfl-bug-getmodules.c
332 #include ELFUTILS_HEADER(dwfl)
337 static const Dwfl_Callbacks callbacks =
339 --- a/tests/dwfllines.c
340 +++ b/tests/dwfllines.c
349 main (int argc, char *argv[])
350 --- a/tests/dwflmodtest.c
351 +++ b/tests/dwflmodtest.c
353 #include <stdio_ext.h>
360 #include ELFUTILS_HEADER(dwfl)
361 --- a/tests/dwfl-report-elf-align.c
362 +++ b/tests/dwfl-report-elf-align.c
364 #include <inttypes.h>
366 #include <stdio_ext.h>
372 --- a/tests/dwflsyms.c
373 +++ b/tests/dwflsyms.c
376 #include <stdio_ext.h>
383 --- a/tests/early-offscn.c
384 +++ b/tests/early-offscn.c
405 --- a/tests/find-prologues.c
406 +++ b/tests/find-prologues.c
408 #include <stdio_ext.h>
416 --- a/tests/funcretval.c
417 +++ b/tests/funcretval.c
419 #include <stdio_ext.h>
427 --- a/tests/funcscopes.c
428 +++ b/tests/funcscopes.c
430 #include <stdio_ext.h>
438 --- a/tests/line2addr.c
439 +++ b/tests/line2addr.c
449 --- a/tests/low_high_pc.c
450 +++ b/tests/low_high_pc.c
452 #include <stdio_ext.h>
460 --- a/tests/md5-sha1-test.c
461 +++ b/tests/md5-sha1-test.c
471 --- a/tests/rdwrmmap.c
472 +++ b/tests/rdwrmmap.c
493 --- a/tests/sectiondump.c
494 +++ b/tests/sectiondump.c
503 #include <inttypes.h>
504 --- a/tests/varlocs.c
505 +++ b/tests/varlocs.c
513 #include <sys/types.h>
514 #include <sys/stat.h>
515 --- a/libelf/libelf.h
516 +++ b/libelf/libelf.h
523 #include <sys/types.h>
525 --- a/libasm/asm_end.c
526 +++ b/libasm/asm_end.c
536 --- a/libasm/asm_newscn.c
537 +++ b/libasm/asm_newscn.c
547 --- a/libcpu/i386_gendis.c
548 +++ b/libcpu/i386_gendis.c
558 --- a/libcpu/i386_lex.c
559 +++ b/libcpu/i386_lex.c
560 @@ -578,7 +578,7 @@ char *i386_text;
569 --- a/libcpu/i386_lex.l
570 +++ b/libcpu/i386_lex.l
580 --- a/libcpu/i386_parse.c
581 +++ b/libcpu/i386_parse.c
588 #include <inttypes.h>
591 --- a/libdw/libdw_alloc.c
592 +++ b/libdw/libdw_alloc.c
601 #include <sys/param.h>
602 @@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hid
606 - error (EXIT_FAILURE, ENOMEM, "libdw");
607 + err (EXIT_FAILURE, "libdw: out of memory");
609 --- a/libebl/eblopenbackend.c
610 +++ b/libebl/eblopenbackend.c
620 --- a/libdwfl/dwfl_error.c
621 +++ b/libdwfl/dwfl_error.c
622 @@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
624 dwfl_errmsg (int error)
626 + static __thread char s[64] = "";
627 if (error == 0 || error == -1)
629 int last_error = global_error;
630 @@ -154,7 +155,8 @@ dwfl_errmsg (int error)
631 switch (error &~ 0xffff)
633 case OTHER_ERROR (ERRNO):
634 - return strerror_r (error & 0xffff, "bad", 0);
635 + strerror_r (error & 0xffff, s, sizeof(s));
637 case OTHER_ERROR (LIBELF):
638 return elf_errmsg (error & 0xffff);
639 case OTHER_ERROR (LIBDW):
640 --- a/libdwfl/libdwfl.h
641 +++ b/libdwfl/libdwfl.h
650 +#ifndef TEMP_FAILURE_RETRY
651 +#define TEMP_FAILURE_RETRY(expression) \
653 + ({ long int __result; \
654 + do __result = (long int) (expression); \
655 + while (__result == -1L && errno == EINTR); \
660 +#define strndupa(s, n) \
661 + (__extension__ ({const char *__in = (s); \
662 + size_t __len = strnlen (__in, (n)) + 1; \
663 + char *__out = (char *) alloca (__len); \
664 + __out[__len-1] = '\0'; \
665 + (char *) memcpy (__out, __in, __len-1);}))
668 /* Handle for a session using the library. */
669 typedef struct Dwfl Dwfl;
670 --- a/libdwfl/find-debuginfo.c
671 +++ b/libdwfl/find-debuginfo.c
672 @@ -385,7 +385,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
673 /* If FILE_NAME is a symlink, the debug file might be associated
674 with the symlink target name instead. */
676 - char *canon = canonicalize_file_name (file_name);
677 + char *canon = realpath (file_name, NULL);
678 if (canon != NULL && strcmp (file_name, canon))
679 fd = find_debuginfo_in_path (mod, canon,
680 debuglink_file, debuglink_crc,
681 --- a/libdwfl/dwfl_build_id_find_elf.c
682 +++ b/libdwfl/dwfl_build_id_find_elf.c
683 @@ -94,7 +94,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
685 if (*file_name != NULL)
687 - *file_name = canonicalize_file_name (name);
688 + *file_name = realpath (name, NULL);
689 if (*file_name == NULL)
692 --- a/libelf/elf_getarsym.c
693 +++ b/libelf/elf_getarsym.c
694 @@ -297,7 +297,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
695 arsym[cnt].as_off = (*u32)[cnt];
697 arsym[cnt].as_hash = _dl_elf_hash (str_data);
698 - str_data = rawmemchr (str_data, '\0') + 1;
699 + str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
702 /* At the end a special entry. */