aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-10-31 20:23:47 +0000
committerIan Lance Taylor <ian@airs.com>1994-10-31 20:23:47 +0000
commitda6c4a8b3ce358e920caa22844580c312e1e79e7 (patch)
treec67e69d4db7656bd6a77a01972922e75e9c56f42
parent2d2d08ed7b2025459531d3776ef3718f41a5d5b4 (diff)
downloadgdb-da6c4a8b3ce358e920caa22844580c312e1e79e7.zip
gdb-da6c4a8b3ce358e920caa22844580c312e1e79e7.tar.gz
gdb-da6c4a8b3ce358e920caa22844580c312e1e79e7.tar.bz2
* archive.c (bfd_dont_truncate_arname): Add the ar padding
character, if there is room for it, even if the name is the maximum length. PR 5859.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/archive.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1f7204c..c88d1bd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
Mon Oct 31 14:19:08 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
+ * archive.c (bfd_dont_truncate_arname): Add the ar padding
+ character, if there is room for it, even if the name is the
+ maximum length.
+
* elfcode.h (assign_file_positions_except_relocs): Sort the ELF
headers by section address when assigning file positions.
(elf_sort_hdrs): New static function.
diff --git a/bfd/archive.c b/bfd/archive.c
index 090c141..a968dd5 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1412,7 +1412,9 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
if (length <= maxlen)
memcpy (hdr->ar_name, filename, length);
- if (length < maxlen)
+ /* Add the padding character if there is room for it. */
+ if (length < maxlen
+ || (length == maxlen && length < sizeof hdr->ar_name))
(hdr->ar_name)[length] = ar_padchar (abfd);
}