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
141 --- a/src/ldgeneric.c
142 +++ b/src/ldgeneric.c
154 @@ -1099,7 +1099,7 @@ char *ldtext;
160 #include <inttypes.h>
178 -/* The error handler. */
179 +/* The err.handler. */
180 static void yyerror (const char *s);
182 /* Some helper functions we need to construct the data structures
193 #include <inttypes.h>
203 #include <inttypes.h>
226 #include <inttypes.h>
237 #include <inttypes.h>
247 #include <inttypes.h>
259 #include <inttypes.h>
264 #include <byteswap.h>
282 --- a/tests/addrscopes.c
283 +++ b/tests/addrscopes.c
285 #include <stdio_ext.h>
293 --- a/tests/allregs.c
294 +++ b/tests/allregs.c
304 --- a/tests/backtrace.c
305 +++ b/tests/backtrace.c
314 #include <sys/resource.h>
315 --- a/tests/backtrace-data.c
316 +++ b/tests/backtrace-data.c
325 #include <sys/resource.h>
326 --- a/tests/buildid.c
327 +++ b/tests/buildid.c
329 #include ELFUTILS_HEADER(elf)
330 #include ELFUTILS_HEADER(dwelf)
336 #include <sys/types.h>
337 --- a/tests/debugaltlink.c
338 +++ b/tests/debugaltlink.c
340 #include ELFUTILS_HEADER(dw)
341 #include ELFUTILS_HEADER(dwelf)
347 #include <sys/types.h>
348 --- a/tests/debuglink.c
349 +++ b/tests/debuglink.c
352 #include ELFUTILS_HEADER(dwelf)
358 #include <sys/types.h>
359 --- a/tests/dwfl-addr-sect.c
360 +++ b/tests/dwfl-addr-sect.c
362 #include <stdio_ext.h>
369 #include ELFUTILS_HEADER(dwfl)
370 --- a/tests/dwfl-bug-addr-overflow.c
371 +++ b/tests/dwfl-bug-addr-overflow.c
373 #include <inttypes.h>
375 #include <stdio_ext.h>
379 #include ELFUTILS_HEADER(dwfl)
381 --- a/tests/dwfl-bug-fd-leak.c
382 +++ b/tests/dwfl-bug-fd-leak.c
391 #include <sys/resource.h>
392 --- a/tests/dwfl-bug-getmodules.c
393 +++ b/tests/dwfl-bug-getmodules.c
396 #include ELFUTILS_HEADER(dwfl)
401 static const Dwfl_Callbacks callbacks =
403 --- a/tests/dwfllines.c
404 +++ b/tests/dwfllines.c
413 main (int argc, char *argv[])
414 --- a/tests/dwflmodtest.c
415 +++ b/tests/dwflmodtest.c
417 #include <stdio_ext.h>
424 #include ELFUTILS_HEADER(dwfl)
425 --- a/tests/dwfl-report-elf-align.c
426 +++ b/tests/dwfl-report-elf-align.c
428 #include <inttypes.h>
430 #include <stdio_ext.h>
436 --- a/tests/dwflsyms.c
437 +++ b/tests/dwflsyms.c
440 #include <stdio_ext.h>
447 --- a/tests/early-offscn.c
448 +++ b/tests/early-offscn.c
461 along with this program. If not, see <http://www.gnu.org/licenses/>. */
469 --- a/tests/find-prologues.c
470 +++ b/tests/find-prologues.c
472 #include <stdio_ext.h>
480 --- a/tests/funcretval.c
481 +++ b/tests/funcretval.c
483 #include <stdio_ext.h>
491 --- a/tests/funcscopes.c
492 +++ b/tests/funcscopes.c
494 #include <stdio_ext.h>
502 --- a/tests/line2addr.c
503 +++ b/tests/line2addr.c
513 --- a/tests/low_high_pc.c
514 +++ b/tests/low_high_pc.c
516 #include <stdio_ext.h>
524 --- a/tests/md5-sha1-test.c
525 +++ b/tests/md5-sha1-test.c
535 --- a/tests/rdwrmmap.c
536 +++ b/tests/rdwrmmap.c
538 along with this program. If not, see <http://www.gnu.org/licenses/>. */
557 --- a/tests/sectiondump.c
558 +++ b/tests/sectiondump.c
567 #include <inttypes.h>
568 --- a/tests/varlocs.c
569 +++ b/tests/varlocs.c
577 #include <sys/types.h>
578 #include <sys/stat.h>
579 --- a/libelf/libelf.h
580 +++ b/libelf/libelf.h
586 #include <sys/types.h>
588 /* Get the ELF types. */
589 --- a/libasm/asm_end.c
590 +++ b/libasm/asm_end.c
600 --- a/libasm/asm_newscn.c
601 +++ b/libasm/asm_newscn.c
611 --- a/libcpu/i386_gendis.c
612 +++ b/libcpu/i386_gendis.c
622 --- a/libcpu/i386_lex.c
623 +++ b/libcpu/i386_lex.c
624 @@ -571,7 +571,7 @@ char *i386_text;
633 --- a/libcpu/i386_lex.l
634 +++ b/libcpu/i386_lex.l
644 --- a/libcpu/i386_parse.c
645 +++ b/libcpu/i386_parse.c
652 #include <inttypes.h>
655 --- a/libdw/libdw_alloc.c
656 +++ b/libdw/libdw_alloc.c
665 #include <sys/param.h>
666 @@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hid
670 - error (EXIT_FAILURE, ENOMEM, "libdw");
671 + err (EXIT_FAILURE, "libdw: out of memory");
673 --- a/libebl/eblopenbackend.c
674 +++ b/libebl/eblopenbackend.c
692 #include <inttypes.h>
695 --- a/libebl/eblwstrtab.c
696 +++ b/libebl/eblwstrtab.c
697 @@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
699 /* Process the current node. */
700 nodep->offset = *offsetp;
701 - *freep = wmempcpy (*freep, nodep->string, nodep->len);
702 + *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
703 *offsetp += nodep->len * sizeof (wchar_t);
705 for (subs = nodep->next; subs != NULL; subs = subs->next)
706 --- a/libdwfl/dwfl_error.c
707 +++ b/libdwfl/dwfl_error.c
708 @@ -141,6 +141,7 @@ const char *
712 + static __thread char s[64] = "";
713 if (error == 0 || error == -1)
715 int last_error = global_error;
716 @@ -155,7 +156,8 @@ dwfl_errmsg (error)
717 switch (error &~ 0xffff)
719 case OTHER_ERROR (ERRNO):
720 - return strerror_r (error & 0xffff, "bad", 0);
721 + strerror_r (error & 0xffff, s, sizeof(s));
723 case OTHER_ERROR (LIBELF):
724 return elf_errmsg (error & 0xffff);
725 case OTHER_ERROR (LIBDW):
726 --- a/libdwfl/libdwfl.h
727 +++ b/libdwfl/libdwfl.h
736 +#ifndef TEMP_FAILURE_RETRY
737 +#define TEMP_FAILURE_RETRY(expression) \
739 + ({ long int __result; \
740 + do __result = (long int) (expression); \
741 + while (__result == -1L && errno == EINTR); \
746 +#define strndupa(s, n) \
747 + (__extension__ ({const char *__in = (s); \
748 + size_t __len = strnlen (__in, (n)) + 1; \
749 + char *__out = (char *) alloca (__len); \
750 + __out[__len-1] = '\0'; \
751 + (char *) memcpy (__out, __in, __len-1);}))
754 /* Handle for a session using the library. */
755 typedef struct Dwfl Dwfl;
756 --- a/libdwfl/find-debuginfo.c
757 +++ b/libdwfl/find-debuginfo.c
758 @@ -360,7 +360,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
759 /* If FILE_NAME is a symlink, the debug file might be associated
760 with the symlink target name instead. */
762 - char *canon = canonicalize_file_name (file_name);
763 + char *canon = realpath (file_name, NULL);
764 if (canon != NULL && strcmp (file_name, canon))
765 fd = find_debuginfo_in_path (mod, canon,
766 debuglink_file, debuglink_crc,
767 --- a/libdwfl/dwfl_build_id_find_elf.c
768 +++ b/libdwfl/dwfl_build_id_find_elf.c
769 @@ -94,7 +94,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
771 if (*file_name != NULL)
773 - *file_name = canonicalize_file_name (name);
774 + *file_name = realpath (name, NULL);
775 if (*file_name == NULL)
778 --- a/libelf/elf_getarsym.c
779 +++ b/libelf/elf_getarsym.c
780 @@ -301,7 +301,7 @@ elf_getarsym (elf, ptr)
781 arsym[cnt].as_off = file_data->u32[cnt];
783 arsym[cnt].as_hash = _dl_elf_hash (str_data);
784 - str_data = rawmemchr (str_data, '\0') + 1;
785 + str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
788 /* At the end a special entry. */