]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ecoff: check result of stat
authorAlan Modra <amodra@gmail.com>
Mon, 3 Mar 2025 04:21:18 +0000 (14:51 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 3 Mar 2025 21:53:16 +0000 (08:23 +1030)
* 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.

bfd/ecoff.c

index 5f9fa43b88f5fedabfab0d8b3c58c5aecb770c8b..a77107b38a73594660b2fff6d0ef95076da86cdf 100644 (file)
@@ -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.  */