aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive64.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-11 16:37:17 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-11 16:37:17 +0000
commit390c0e4288ca46982c7702ec420d277c021032f4 (patch)
tree8ef7610d22b3b1a098067cab4313176a19d31abd /bfd/archive64.c
parente8d46048877776c7f0e0e12578c6eecae5199dcf (diff)
downloadgdb-390c0e4288ca46982c7702ec420d277c021032f4.zip
gdb-390c0e4288ca46982c7702ec420d277c021032f4.tar.gz
gdb-390c0e4288ca46982c7702ec420d277c021032f4.tar.bz2
* libbfd-in.h (_bfd_ar_spacepad): New prototype.
* libbfd.h: Rebuilt. * archive.c (_bfd_ar_spacepad): New function. (_bfd_construct_extended_name_table, _bfd_write_archive_contents, bsd_write_armap, _bfd_archive_bsd_update_armap_timestamp, coff_write_armap): Use it. (bfd_ar_hdr_from_filesystem): Likewise. Fix HP-UX large uid/gid support. * archive64.c (bfd_elf64_archive_write_armap): Use _bfd_ar_spacepad.
Diffstat (limited to 'bfd/archive64.c')
-rw-r--r--bfd/archive64.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 1b9f5f3..6ee0d1a 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -156,7 +156,6 @@ bfd_elf64_archive_write_armap (bfd *arch,
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
- unsigned int i;
int padding;
bfd_byte buf[8];
@@ -169,19 +168,17 @@ bfd_elf64_archive_write_armap (bfd *arch,
+ sizeof (struct ar_hdr)
+ SARMAG);
- memset (&hdr, 0, sizeof (struct ar_hdr));
- strcpy (hdr.ar_name, "/SYM64/");
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
+ memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
+ mapsize);
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ time (NULL));
/* This, at least, is what Intel coff sets the values to.: */
- sprintf ((hdr.ar_uid), "%d", 0);
- sprintf ((hdr.ar_gid), "%d", 0);
- sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
- strncpy (hdr.ar_fmag, ARFMAG, 2);
-
- for (i = 0; i < sizeof (struct ar_hdr); i++)
- if (((char *) (&hdr))[i] == '\0')
- (((char *) (&hdr))[i]) = ' ';
+ _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
/* Write the ar header for this item and the number of symbols */