This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ar xo


Hi!

ar is ATM setting st_atime to whatever value ends up in the buf.st_atime
field of unitialized buf structure (bfd_stat_arch_elt only initializes
st_mtime from the st_[act]ime, while set_times sets atime/mtime
from the st_atime/st_mtime fields).
Ok to commit?

2004-10-25  Jakub Jelinek  <jakub@redhat.com>

	* ar.c (extract_file): Set atime to mtime for ar xo.

--- binutils/ar.c.jj	2004-09-19 16:26:42.000000000 +0200
+++ binutils/ar.c	2004-10-25 18:34:43.906879459 +0200
@@ -935,7 +935,12 @@ extract_file (bfd *abfd)
   chmod (bfd_get_filename (abfd), buf.st_mode);
 
   if (preserve_dates)
-    set_times (bfd_get_filename (abfd), &buf);
+    {
+      /* Set access time to modification time.  Only st_mtime is
+	 initialized by bfd_stat_arch_elt.  */
+      buf.st_atime = buf.st_mtime;
+      set_times (bfd_get_filename (abfd), &buf);
+    }
 
   free (cbuf);
 }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]