From 27b1ec94784b837c366ebd3a2cfa754f07620368 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 4 Jul 1995 20:22:43 +0000 Subject: * archive.c (_bfd_construct_extended_name_table): If BFD_TRADITIONAL_FORMAT is set, limit the length of all file names to ar_max_namelen. (bfd_dont_truncate_arname): If BFD_TRADITIONAL_FORMAT is set, call bfd_bsd_truncate_arname. PR 6888. --- bfd/archive.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'bfd/archive.c') diff --git a/bfd/archive.c b/bfd/archive.c index 53de8fc..44cad84 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -1240,6 +1240,11 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen) return false; thislen = strlen (normal); + + if (thislen > maxname + && (bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) + thislen = maxname; + if (thislen > maxname) { /* Add one to leave room for \n. */ @@ -1449,6 +1454,12 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr) const char *filename; int maxlen = ar_maxnamelen (abfd); + if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) + { + bfd_bsd_truncate_arname (abfd, pathname, arhdr); + return; + } + filename = normalize (abfd, pathname); if (filename == NULL) { @@ -1592,14 +1603,6 @@ _bfd_write_archive_contents (arch) } } - /* @@ This leads to archives that are incompatible with the native - AR on many systems, such as HP/UX and SunOS. [Cygnus PR - binutils/6888] It's a nice extension, but unless it can be made - optional, we shouldn't use it. This is a lame fix, but I don't - have time to fix it right just now. KR 1995/06/01 */ - /* Turning it off is a disaster for the many people who rely upon - it. We should make it optional, but since that is evidently not - happening soon it needs to be used by default. ILT 1995/07/04. */ if (!BFD_SEND (arch, _bfd_construct_extended_name_table, (arch, &etable, &elength, &ename))) return false; -- cgit v1.1