Fixed a potential blind spot of 1 second in -disk_dev_ino comparison
This commit is contained in:
@ -1572,6 +1572,7 @@ completed:;
|
||||
0= ls -l format
|
||||
1= timestamp format YYYY.MM.DD.hhmmss
|
||||
2= Wdy Mon Day hh:mm:ss Year
|
||||
3= Mon Day hh:mm:ss Year
|
||||
*/
|
||||
char *Ftimetxt(time_t t, char timetext[40], int flag)
|
||||
{
|
||||
@ -1596,6 +1597,10 @@ char *Ftimetxt(time_t t, char timetext[40], int flag)
|
||||
sprintf(rpt+strlen(rpt), "%s %s %2.2d %2.2d:%2.2d:%2.2d %4.4d",
|
||||
days[tms.tm_wday], months[tms.tm_mon], tms.tm_mday,
|
||||
tms.tm_hour, tms.tm_min, tms.tm_sec, 1900+tms.tm_year);
|
||||
else if (form==3)
|
||||
sprintf(rpt+strlen(rpt), "%s %2.2d %2.2d:%2.2d:%2.2d %4.4d",
|
||||
months[tms.tm_mon], tms.tm_mday,
|
||||
tms.tm_hour, tms.tm_min, tms.tm_sec, 1900+tms.tm_year);
|
||||
else if (flag&1)
|
||||
sprintf(rpt+strlen(rpt), "%2d %3s %4.4d %2.2d:%2.2d:%2.2d",
|
||||
tms.tm_mday, months[tms.tm_mon], 1900+tms.tm_year,
|
||||
@ -4103,6 +4108,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->in_drive_handle= NULL;
|
||||
m->in_volset_handle= NULL;
|
||||
m->in_charset= NULL;
|
||||
m->isofs_st_out= time(0) - 1;
|
||||
m->isofs_st_in= 0;
|
||||
m->volset_change_pending= 0;
|
||||
m->no_volset_present= 0;
|
||||
m->in_sector_map= NULL;
|
||||
@ -6772,6 +6779,7 @@ cannot_address:;
|
||||
bit20= xattr differ
|
||||
bit21= mismatch of recorded dev,inode
|
||||
bit22= no recorded dev,inode found in node
|
||||
bit23= timestamps younger than xorriso->isofs_st_in
|
||||
@param flag bit0= compare atime
|
||||
bit1= compare ctime
|
||||
bit2= check only existence of both file objects
|
||||
@ -6797,6 +6805,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
|
||||
char *attrlist1= NULL, *attrlist2= NULL;
|
||||
struct SplitparT *split_parts= NULL;
|
||||
int split_count= 0;
|
||||
time_t stamp;
|
||||
|
||||
char part_path[SfileadrL], *part_name;
|
||||
int partno, total_parts= 0;
|
||||
@ -7016,6 +7025,11 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
|
||||
(*result)|= 1024;
|
||||
}
|
||||
}
|
||||
if(xorriso->isofs_st_in > 0 &&
|
||||
(xorriso->isofs_st_in <= s2.st_mtime ||
|
||||
((flag & 1) && xorriso->isofs_st_in <= s2.st_atime) ||
|
||||
((flag & 2) && xorriso->isofs_st_in <= s2.st_ctime)))
|
||||
(*result)|= 1 << 23;
|
||||
|
||||
if(xorriso->do_aaip & 32) {
|
||||
/* dev,inode comparison. Eventually skip content comparison */
|
||||
@ -7026,8 +7040,26 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
|
||||
} else if(ret == 0) { /* match */
|
||||
if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){
|
||||
content_shortcut= 1;
|
||||
if((*result) & (8 | 128 | 256 | 512 | 1024)) {
|
||||
if((*result) & (8 | 128 | 256 | 512 | 1024 | (1 << 23))) {
|
||||
(*result)|= (1 << 15); /* content bytes differ */
|
||||
if(((*result) & (1 << 23)) &&
|
||||
!((*result) & (8 | 128 | 256 | 512 | 1024))) {
|
||||
sprintf(respt,
|
||||
"%s content : node timestamp younger than image timestamp\n", a);
|
||||
if(!(flag&(1<<31)))
|
||||
Xorriso_result(xorriso,0);
|
||||
stamp= s2.st_mtime;
|
||||
if((flag & 1) && s2.st_atime >= stamp)
|
||||
stamp= s2.st_atime;
|
||||
if((flag & 2) && s2.st_ctime >= stamp)
|
||||
stamp= s2.st_ctime;
|
||||
sprintf(respt, "%s content : %s > %s diff= %.f s\n",
|
||||
a, Ftimetxt(stamp, ttx1, 3 << 1),
|
||||
Ftimetxt(xorriso->isofs_st_in, ttx2, 3 << 1),
|
||||
((double) stamp) - (double) xorriso->isofs_st_in);
|
||||
if(!(flag&(1<<31)))
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
sprintf(respt,
|
||||
"%s content : assuming inequality due to size or timestamps\n", a);
|
||||
if(!(flag&(1<<31)))
|
||||
|
Reference in New Issue
Block a user