diff options
author | pfg <pfg@FreeBSD.org> | 2013-06-01 14:16:51 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2013-06-01 14:16:51 +0000 |
commit | 5750b86515d75792972b36539d4a3e166b31d925 (patch) | |
tree | 9ccb38c88a217d3ef08308907c0059fbf9ebb79c /contrib/binutils/bfd/coff-rs6000.c | |
parent | bfce0b30fa1e29d33ded21e07c6ecbc40c95de0d (diff) | |
download | FreeBSD-src-5750b86515d75792972b36539d4a3e166b31d925.zip FreeBSD-src-5750b86515d75792972b36539d4a3e166b31d925.tar.gz |
BFD: Use time_t instead of long for archive timestamps.
This basically follows the suggestion in the binutils code and is more
in line with what BSD ar(1) does.
Obtained from: OpenBSD
MFC after: 2 weeks.
Diffstat (limited to 'contrib/binutils/bfd/coff-rs6000.c')
-rw-r--r-- | contrib/binutils/bfd/coff-rs6000.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c index f446f49..c3a48fe 100644 --- a/contrib/binutils/bfd/coff-rs6000.c +++ b/contrib/binutils/bfd/coff-rs6000.c @@ -1548,7 +1548,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s) { struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd); - s->st_mtime = strtol (hdrp->date, (char **) NULL, 10); + s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10); s->st_uid = strtol (hdrp->uid, (char **) NULL, 10); s->st_gid = strtol (hdrp->gid, (char **) NULL, 10); s->st_mode = strtol (hdrp->mode, (char **) NULL, 8); @@ -1558,7 +1558,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s) { struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd); - s->st_mtime = strtol (hdrp->date, (char **) NULL, 10); + s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10); s->st_uid = strtol (hdrp->uid, (char **) NULL, 10); s->st_gid = strtol (hdrp->gid, (char **) NULL, 10); s->st_mode = strtol (hdrp->mode, (char **) NULL, 8); @@ -1678,6 +1678,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1]; #define FMT20 "%-20lld" #define FMT12 "%-12d" +#define FMT12_LL "%-12lld" #define FMT12_OCTAL "%-12o" #define FMT4 "%-4d" #define PRINT20(d, v) \ @@ -1688,6 +1689,10 @@ static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1]; sprintf (buff20, FMT12, (int)(v)), \ memcpy ((void *) (d), buff20, 12) +#define PRINT12_LL(d, v) \ + sprintf (buff20, FMT12_LL, (long long)(v)), \ + memcpy ((void *) (d), buff20, 12) + #define PRINT12_OCTAL(d, v) \ sprintf (buff20, FMT12_OCTAL, (unsigned int)(v)), \ memcpy ((void *) (d), buff20, 12) @@ -2152,7 +2157,7 @@ xcoff_write_archive_contents_old (abfd) } sprintf (ahdrp->size, "%ld", (long) s.st_size); - sprintf (ahdrp->date, "%ld", (long) s.st_mtime); + sprintf (ahdrp->date, "%lld", (long long) s.st_mtime); sprintf (ahdrp->uid, "%ld", (long) s.st_uid); sprintf (ahdrp->gid, "%ld", (long) s.st_gid); sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode); @@ -2388,7 +2393,7 @@ xcoff_write_archive_contents_big (abfd) } PRINT20 (ahdrp->size, s.st_size); - PRINT12 (ahdrp->date, s.st_mtime); + PRINT12_LL (ahdrp->date, s.st_mtime); PRINT12 (ahdrp->uid, s.st_uid); PRINT12 (ahdrp->gid, s.st_gid); PRINT12_OCTAL (ahdrp->mode, s.st_mode); |