aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-03-03 14:51:18 +1030
committerAlan Modra <amodra@gmail.com>2025-03-04 08:23:16 +1030
commit7720707bb85f461ad5d29f1cbc49f5c9a3c5d041 (patch)
tree258b657447b1135f3c985893405b925ad9ee4d82
parenta8a9fc74297636d8e6502c090d51f46f82aae1ea (diff)
downloadbinutils-7720707bb85f461ad5d29f1cbc49f5c9a3c5d041.zip
binutils-7720707bb85f461ad5d29f1cbc49f5c9a3c5d041.tar.gz
binutils-7720707bb85f461ad5d29f1cbc49f5c9a3c5d041.tar.bz2
ecoff: check result of stat
* ecoff.c (_bfd_ecoff_write_armap): Don't use statbuf.st_mtime if stat call returns non-zero. Use ARMAP_TIME_OFFSET rather than its expansion.
-rw-r--r--bfd/ecoff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 5f9fa43..a77107b 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -3132,9 +3132,9 @@ _bfd_ecoff_write_armap (bfd *abfd,
complain that the index is out of date. Actually, the Ultrix
linker just checks the archive name; the GNU linker may check the
date. */
- stat (bfd_get_filename (abfd), &statbuf);
- _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
- (long) (statbuf.st_mtime + 60));
+ if (stat (bfd_get_filename (abfd), &statbuf) == 0)
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ (long) (statbuf.st_mtime + ARMAP_TIME_OFFSET));
/* The DECstation uses zeroes for the uid, gid and mode of the
armap. */