This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix ar xo
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 25 Oct 2004 18:36:55 +0200
- Subject: [PATCH] Fix ar xo
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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