diff options
author | 2013-04-19 23:20:53 +0000 | |
---|---|---|
committer | 2013-04-19 23:20:53 +0000 | |
commit | d04417c8bbac460f44f2231b23295dffb631d02d (patch) | |
tree | 5a73e06c72e08146cf9ed533cac9485b06f71a44 | |
parent | Revert 1.47 (bad merge) (diff) | |
download | wireguard-openbsd-d04417c8bbac460f44f2231b23295dffb631d02d.tar.xz wireguard-openbsd-d04417c8bbac460f44f2231b23295dffb631d02d.zip |
Use time_t instead of long for archive timestamps, and print them as long long;
prodding deraadt@
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/archive.c | 11 | ||||
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/bfd-in2.h | 3 | ||||
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/bfdio.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/coff-rs6000.c | 13 | ||||
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/ecoff.c | 2 | ||||
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/libbfd-in.h | 3 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/archive.c | 9 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/bfd-in2.h | 3 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/bfdio.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/coff-rs6000.c | 13 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/ecoff.c | 2 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/bfd/libbfd-in.h | 3 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/corefile.c | 2 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/source.c | 2 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/symfile.c | 2 |
15 files changed, 48 insertions, 28 deletions
diff --git a/gnu/usr.bin/binutils-2.17/bfd/archive.c b/gnu/usr.bin/binutils-2.17/bfd/archive.c index 5a12f01f7cc..38c24840cfc 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/archive.c +++ b/gnu/usr.bin/binutils-2.17/bfd/archive.c @@ -1390,8 +1390,8 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) /* ar headers are space padded, not null padded! */ memset (hdr, ' ', sizeof (struct ar_hdr)); - _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld", - status.st_mtime); + _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12lld", + (long long)status.st_mtime); #ifdef HPUX_LARGE_AR_IDS /* HP has a very "special" way to handle UID/GID's with numeric values > 99999. */ @@ -1458,6 +1458,11 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) if (aloser == hdr->arelt) \ return -1; +#define fooll(arelt, stelt, size) \ + buf->stelt = strtoll (hdr->arelt, &aloser, size); \ + if (aloser == hdr->arelt) \ + return -1; + /* Some platforms support special notations for large IDs. */ #ifdef HPUX_LARGE_AR_IDS # define foo2(arelt, stelt, size) \ @@ -1484,7 +1489,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) # define foo2(arelt, stelt, size) foo (arelt, stelt, size) #endif - foo (ar_date, st_mtime, 10); + fooll (ar_date, st_mtime, 10); foo2 (ar_uid, st_uid, 10); foo2 (ar_gid, st_gid, 10); foo (ar_mode, st_mode, 8); diff --git a/gnu/usr.bin/binutils-2.17/bfd/bfd-in2.h b/gnu/usr.bin/binutils-2.17/bfd/bfd-in2.h index 63fb521b0ab..299fc0ff35e 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/bfd-in2.h +++ b/gnu/usr.bin/binutils-2.17/bfd/bfd-in2.h @@ -38,6 +38,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" +#include <time.h> /* time_t */ #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #ifndef SABER /* This hack is to avoid a problem with some strict ANSI C preprocessors. @@ -1068,7 +1069,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section /* Extracted from bfdio.c. */ -long bfd_get_mtime (bfd *abfd); +time_t bfd_get_mtime (bfd *abfd); long bfd_get_size (bfd *abfd); diff --git a/gnu/usr.bin/binutils-2.17/bfd/bfdio.c b/gnu/usr.bin/binutils-2.17/bfd/bfdio.c index 22ea886b5cb..6436c0c441a 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/bfdio.c +++ b/gnu/usr.bin/binutils-2.17/bfd/bfdio.c @@ -370,7 +370,7 @@ FUNCTION bfd_get_mtime SYNOPSIS - long bfd_get_mtime (bfd *abfd); + time_t bfd_get_mtime (bfd *abfd); DESCRIPTION Return the file modification time (as read from the file system, or @@ -378,7 +378,7 @@ DESCRIPTION */ -long +time_t bfd_get_mtime (bfd *abfd) { struct stat buf; diff --git a/gnu/usr.bin/binutils-2.17/bfd/coff-rs6000.c b/gnu/usr.bin/binutils-2.17/bfd/coff-rs6000.c index 951587f99b1..ecc8e76bd2a 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/coff-rs6000.c +++ b/gnu/usr.bin/binutils-2.17/bfd/coff-rs6000.c @@ -1537,7 +1537,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); @@ -1547,7 +1547,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); @@ -1667,6 +1667,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) \ @@ -1677,6 +1678,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) @@ -2139,7 +2144,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); @@ -2375,7 +2380,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); diff --git a/gnu/usr.bin/binutils-2.17/bfd/ecoff.c b/gnu/usr.bin/binutils-2.17/bfd/ecoff.c index 75e1cc2a398..c5360a4303b 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/ecoff.c +++ b/gnu/usr.bin/binutils-2.17/bfd/ecoff.c @@ -3050,7 +3050,7 @@ _bfd_ecoff_write_armap (bfd *abfd, linker just checks the archive name; the GNU linker may check the date. */ stat (abfd->filename, &statbuf); - sprintf (hdr.ar_date, "%ld", (long) (statbuf.st_mtime + 60)); + sprintf (hdr.ar_date, "%lld", (long long) (statbuf.st_mtime + 60)); /* The DECstation uses zeroes for the uid, gid and mode of the armap. */ diff --git a/gnu/usr.bin/binutils-2.17/bfd/libbfd-in.h b/gnu/usr.bin/binutils-2.17/bfd/libbfd-in.h index ee2484f25c1..82f7d68042a 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/libbfd-in.h +++ b/gnu/usr.bin/binutils-2.17/bfd/libbfd-in.h @@ -71,8 +71,7 @@ struct artdata { symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ bfd_size_type extended_names_size; /* Size of extended names */ - /* when more compilers are standard C, this can be a time_t */ - long armap_timestamp; /* Timestamp value written into armap. + time_t armap_timestamp; /* Timestamp value written into armap. This is used for BSD archives to check that the timestamp is recent enough for the BSD linker to not complain, diff --git a/gnu/usr.bin/binutils/bfd/archive.c b/gnu/usr.bin/binutils/bfd/archive.c index ba6e684ee23..6c8397c71bb 100644 --- a/gnu/usr.bin/binutils/bfd/archive.c +++ b/gnu/usr.bin/binutils/bfd/archive.c @@ -1364,7 +1364,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) strncpy (hdr->ar_fmag, ARFMAG, 2); /* Goddamned sprintf doesn't permit MAXIMUM field lengths. */ - sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime); + sprintf ((hdr->ar_date), "%-12lld", (long long) status.st_mtime); #ifdef HPUX_LARGE_AR_IDS /* HP has a very "special" way to handle UID/GID's with numeric values > 99999. */ @@ -1437,6 +1437,11 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) if (aloser == hdr->arelt) \ return -1; +#define fooll(arelt, stelt, size) \ + buf->stelt = strtoll (hdr->arelt, &aloser, size); \ + if (aloser == hdr->arelt) \ + return -1; + /* Some platforms support special notations for large IDs. */ #ifdef HPUX_LARGE_AR_IDS # define foo2(arelt, stelt, size) \ @@ -1463,7 +1468,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) # define foo2(arelt, stelt, size) foo (arelt, stelt, size) #endif - foo (ar_date, st_mtime, 10); + fooll (ar_date, st_mtime, 10); foo2 (ar_uid, st_uid, 10); foo2 (ar_gid, st_gid, 10); foo (ar_mode, st_mode, 8); diff --git a/gnu/usr.bin/binutils/bfd/bfd-in2.h b/gnu/usr.bin/binutils/bfd/bfd-in2.h index 23ae31fcde9..c992c1a7ed9 100644 --- a/gnu/usr.bin/binutils/bfd/bfd-in2.h +++ b/gnu/usr.bin/binutils/bfd/bfd-in2.h @@ -37,6 +37,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" +#include <time.h> /* time_t */ #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #ifndef SABER /* This hack is to avoid a problem with some strict ANSI C preprocessors. @@ -979,7 +980,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section /* Extracted from bfdio.c. */ -long bfd_get_mtime (bfd *abfd); +time_t bfd_get_mtime (bfd *abfd); long bfd_get_size (bfd *abfd); diff --git a/gnu/usr.bin/binutils/bfd/bfdio.c b/gnu/usr.bin/binutils/bfd/bfdio.c index a90cb33ea5f..ac58d463178 100644 --- a/gnu/usr.bin/binutils/bfd/bfdio.c +++ b/gnu/usr.bin/binutils/bfd/bfdio.c @@ -367,7 +367,7 @@ FUNCTION bfd_get_mtime SYNOPSIS - long bfd_get_mtime (bfd *abfd); + time_t bfd_get_mtime (bfd *abfd); DESCRIPTION Return the file modification time (as read from the file system, or @@ -375,7 +375,7 @@ DESCRIPTION */ -long +time_t bfd_get_mtime (bfd *abfd) { FILE *fp; diff --git a/gnu/usr.bin/binutils/bfd/coff-rs6000.c b/gnu/usr.bin/binutils/bfd/coff-rs6000.c index 56e34e2d720..ca764813ce4 100644 --- a/gnu/usr.bin/binutils/bfd/coff-rs6000.c +++ b/gnu/usr.bin/binutils/bfd/coff-rs6000.c @@ -1535,7 +1535,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); @@ -1545,7 +1545,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); @@ -1665,6 +1665,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) \ @@ -1675,6 +1676,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) @@ -2141,7 +2146,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); @@ -2377,7 +2382,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); diff --git a/gnu/usr.bin/binutils/bfd/ecoff.c b/gnu/usr.bin/binutils/bfd/ecoff.c index cfc5ae1b9fa..bd3e9ffd6bb 100644 --- a/gnu/usr.bin/binutils/bfd/ecoff.c +++ b/gnu/usr.bin/binutils/bfd/ecoff.c @@ -3189,7 +3189,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) linker just checks the archive name; the GNU linker may check the date. */ stat (abfd->filename, &statbuf); - sprintf (hdr.ar_date, "%ld", (long) (statbuf.st_mtime + 60)); + sprintf (hdr.ar_date, "%lld", (long long) (statbuf.st_mtime + 60)); /* The DECstation uses zeroes for the uid, gid and mode of the armap. */ diff --git a/gnu/usr.bin/binutils/bfd/libbfd-in.h b/gnu/usr.bin/binutils/bfd/libbfd-in.h index 10cafefd6ed..1ea7f8e09f7 100644 --- a/gnu/usr.bin/binutils/bfd/libbfd-in.h +++ b/gnu/usr.bin/binutils/bfd/libbfd-in.h @@ -61,8 +61,7 @@ struct artdata { carsym *symdefs; /* the symdef entries */ symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ - /* when more compilers are standard C, this can be a time_t */ - long armap_timestamp; /* Timestamp value written into armap. + time_t armap_timestamp; /* Timestamp value written into armap. This is used for BSD archives to check that the timestamp is recent enough for the BSD linker to not complain, diff --git a/gnu/usr.bin/binutils/gdb/corefile.c b/gnu/usr.bin/binutils/gdb/corefile.c index 91519b97f63..d3fb9498a72 100644 --- a/gnu/usr.bin/binutils/gdb/corefile.c +++ b/gnu/usr.bin/binutils/gdb/corefile.c @@ -151,7 +151,7 @@ reopen_exec_file (void) char *filename; int res; struct stat st; - long mtime; + time_t mtime; /* Don't do anything if the current target isn't exec. */ if (exec_bfd == NULL || strcmp (target_shortname, "exec") != 0) diff --git a/gnu/usr.bin/binutils/gdb/source.c b/gnu/usr.bin/binutils/gdb/source.c index f0dc5542b8e..21bddf1c355 100644 --- a/gnu/usr.bin/binutils/gdb/source.c +++ b/gnu/usr.bin/binutils/gdb/source.c @@ -979,7 +979,7 @@ find_source_lines (struct symtab *s, int desc) int nlines = 0; int lines_allocated = 1000; int *line_charpos; - long mtime = 0; + time_t mtime = 0; int size; line_charpos = (int *) xmalloc (lines_allocated * sizeof (int)); diff --git a/gnu/usr.bin/binutils/gdb/symfile.c b/gnu/usr.bin/binutils/gdb/symfile.c index 160e2c464dd..5c09ccc1616 100644 --- a/gnu/usr.bin/binutils/gdb/symfile.c +++ b/gnu/usr.bin/binutils/gdb/symfile.c @@ -1802,7 +1802,7 @@ void reread_symbols (void) { struct objfile *objfile; - long new_modtime; + time_t new_modtime; int reread_one = 0; struct stat new_statbuf; int res; |