Don't filter time stamps through the resolution supported
by struct stat; keep them to full nanosecond resolution. This affects behavior only on older hosts or file systems that have lower-resolution time stamps. * src/common.h (OLDER_STAT_TIME): Parenthesize arg. (OLDER_TAR_STAT_TIME): New macro. (code_timespec): New function. (BILLION, LOG10_BILLION, TIMESPEC_STRSIZE_BOUND): New constants. * src/compare.c (diff_file): Use full time stamp resolution. * src/create.c (start_header, dump_file0): Likewise. (start_header, dump_file0): Adjust to new structure layout. (dump_regular_finish): Simplify by using timespec_cmp. * src/extract.c (struct delayed_set_stat): Don't store stat info that we don't need, to save space. All uses changed. (struct delayed_set_stat, struct delayed_link, file_newer_p): (create_placeholder_file, extract_link, apply_delayed_links): Use full time stamp resolution. (check_time): Use code_timespec rather than rolling our own code. (set_stat, delay_set_stat): Arg now points to tar_stat_info to avoid losing time information. All callers changed. * src/list.c (read_and, decode_header, print_heaeder): Use full time stamp resolution. * src/misc.c (code_timespec): New function. * src/tar.h (struct tar_stat_info): Record atime, mtime, ctime separately, for benefit of hosts with lower resolution. * src/update.c (update_archive): Use full time stamp resolution. * src/xheader.c (code_time): Use new code_timespec function to simplify code. (atime_coder, atime_decoder, ctime_coder, ctime_decoder): (mtime_coder, mtime_decoder): Use full time stamp resolution. Report time stamps to full resolution in environment. Report memory allocation failures rather than ignoring them. * src/system.c (time_to_env): New function. (oct_to_env, str_to_env, chr_to_env): Report memory allocation failures. (stat_to_env): Report full resolution in time stamps.
This commit is contained in:
@@ -129,7 +129,7 @@ update_archive (void)
|
||||
decode_header (current_header, ¤t_stat_info,
|
||||
¤t_format, 0);
|
||||
archive_format = current_format;
|
||||
|
||||
|
||||
if (subcommand_option == UPDATE_SUBCOMMAND
|
||||
&& (name = name_scan (current_stat_info.file_name)) != NULL)
|
||||
{
|
||||
@@ -138,7 +138,9 @@ update_archive (void)
|
||||
chdir_do (name->change_dir);
|
||||
if (deref_stat (dereference_option,
|
||||
current_stat_info.file_name, &s) == 0
|
||||
&& s.st_mtime <= current_stat_info.stat.st_mtime)
|
||||
&& (timespec_cmp (get_stat_mtime (&s),
|
||||
current_stat_info.mtime)
|
||||
<= 0))
|
||||
add_avoided_name (current_stat_info.file_name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user