reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-tar/2011-03/msg00000.html>.
* src/compare.c (diff_file): Do not restore atime of size-zero files.
* src/create.c (dump_file0): Likewise. Also, do not restore atime
when fd is zero, because that indicates a file we haven't opened.
else
read_and_process (¤t_stat_info, process_rawdata);
- if (atime_preserve_option == replace_atime_preserve)
+ if (atime_preserve_option == replace_atime_preserve
+ && stat_data.st_size != 0)
{
struct timespec atime = get_stat_atime (&stat_data);
if (set_file_atime (diff_handle, chdir_fd, file_name, atime)
if (may_fail)
WARN((0, 0,
_("Verification may fail to locate original files.")));
-
+
if (!diff_buffer)
diff_init ();
set_exit_status (TAREXIT_DIFFERS);
}
else if (atime_preserve_option == replace_atime_preserve
+ && fd && (is_dir || original_size != 0)
&& set_file_atime (fd, parentfd, name, st->atime) != 0)
utime_error (p);
}