"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/cmp_update.c" between
libisoburn-1.5.0.tar.gz and libisoburn-1.5.2.tar.gz

About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.

cmp_update.c  (libisoburn-1.5.0):cmp_update.c  (libisoburn-1.5.2)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains the implementation of actions which compare or update This file contains the implementation of actions which compare or update
files between disk filesystem and ISO filesystem. files between disk filesystem and ISO filesystem.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 64 skipping to change at line 64
char *iso_adr, off_t iso_size, char *iso_adr, off_t iso_size,
int *result, int flag) int *result, int flag)
{ {
int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0, use_md5= 0; int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0, use_md5= 0;
void *stream2= NULL; void *stream2= NULL;
off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1;
char *respt, *buf1= NULL, *buf2= NULL, offset_text[80]; char *respt, *buf1= NULL, *buf2= NULL, offset_text[80];
char disk_md5[16], iso_md5[16]; char disk_md5[16], iso_md5[16];
void *ctx= NULL; void *ctx= NULL;
int buf_size= 32 * 1024; int buf_size= 32 * 1024;
double dcount;
Xorriso_alloc_meM(buf1, char, buf_size); Xorriso_alloc_meM(buf1, char, buf_size);
Xorriso_alloc_meM(buf2, char, buf_size); Xorriso_alloc_meM(buf2, char, buf_size);
respt= xorriso->result_line; respt= xorriso->result_line;
fd1= open(disk_adr, O_RDONLY | O_BINARY); fd1= open(disk_adr, O_RDONLY | O_BINARY);
if(fd1==-1) { if(fd1==-1) {
sprintf(respt, "- %s (DISK) : cannot open() : %s\n", sprintf(respt, "- %s (DISK) : cannot open() : %s\n",
disk_adr, strerror(errno)); disk_adr, strerror(errno));
cannot_address:; cannot_address:;
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 2048; (*result)|= 2048;
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
if(offset>0) if(offset>0)
if(lseek(fd1, offset, SEEK_SET)==-1) { if(lseek(fd1, offset, SEEK_SET)==-1) {
sprintf(respt, "- %s (DISK) : cannot lseek(%.f) : %s\n", sprintf(respt, "- %s (DISK) : cannot lseek(%.f) : %s\n",
disk_adr, (double) offset, strerror(errno)); disk_adr, (double) offset, strerror(errno));
close(fd1); close(fd1);
goto cannot_address; goto cannot_address;
skipping to change at line 107 skipping to change at line 108
else { else {
ret= Xorriso_md5_start(xorriso, &ctx, 0); ret= Xorriso_md5_start(xorriso, &ctx, 0);
if(ret <= 0) if(ret <= 0)
use_md5= 0; use_md5= 0;
} }
} }
if (! use_md5) { if (! use_md5) {
ret= Xorriso_iso_file_open(xorriso, iso_adr, NULL, &stream2, 0); ret= Xorriso_iso_file_open(xorriso, iso_adr, NULL, &stream2, 0);
if(ret<=0) { if(ret<=0) {
sprintf(respt, "- %s (ISO) : cannot open() file in ISO image\n",iso_adr); sprintf(respt, "- %s (ISO) : cannot open() file in ISO image\n",iso_adr);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
close(fd1); close(fd1);
(*result)|= 4096; (*result)|= 4096;
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
} }
done= 0; done= 0;
while(!done) { while(!done) {
skipping to change at line 157 skipping to change at line 158
was_error= 1; was_error= 1;
if(r1<=0 && r2<=0) if(r1<=0 && r2<=0)
break; break;
if(r1<=0) { if(r1<=0) {
if(r1<0) if(r1<0)
r1= 0; r1= 0;
if(disk_size > r1count + r1 + offset) { if(disk_size > r1count + r1 + offset) {
sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n", sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n",
disk_adr, (double) r1count); disk_adr, (double) r1count);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 8196; (*result)|= 8196;
} }
(*result)|= (1<<15); (*result)|= (1<<15);
} }
r1count+= r1; r1count+= r1;
if(r2<=0 || r2<r1) { if(r2<=0 || r2<r1) {
if(r2<0) if(r2<0)
r2= 0; r2= 0;
if(iso_size > r2count + r2) { if(iso_size > r2count + r2) {
sprintf(respt, "- %s (ISO) : early EOF after %.f bytes\n", sprintf(respt, "- %s (ISO) : early EOF after %.f bytes\n",
iso_adr, (double) r2count); iso_adr, (double) r2count);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= (1<<14); (*result)|= (1<<14);
} }
(*result)|= (1<<15); (*result)|= (1<<15);
done= 1; done= 1;
} }
if(r2>r1) { if(r2>r1) {
if(disk_size > r1count + r1 + offset) { if(disk_size > r1count + r1 + offset) {
sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n", sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n",
disk_adr, (double) r1count); disk_adr, (double) r1count);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 8196; (*result)|= 8196;
} }
(*result)|= (1<<15); (*result)|= (1<<15);
done= 1; done= 1;
} }
r2count+= r2; r2count+= r2;
if(r1>r2) if(r1>r2)
r1= r2; r1= r2;
skipping to change at line 206 skipping to change at line 207
if(buf1[i]!=buf2[i]) { if(buf1[i]!=buf2[i]) {
if(first_diff<0) if(first_diff<0)
first_diff= r1count - r1 + i; first_diff= r1count - r1 + i;
diffcount++; diffcount++;
} }
} }
} }
if(!(flag&(1<<29))) { if(!(flag&(1<<29))) {
xorriso->pacifier_count+= r1; xorriso->pacifier_count+= r1;
xorriso->pacifier_byte_count+= r1; xorriso->pacifier_byte_count+= r1;
if(flag&(1<<31)) if(flag&(1u<<31))
Xorriso_pacifier_callback(xorriso, "content bytes read", Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 8); xorriso->pacifier_count, 0, "", 8);
else else
Xorriso_pacifier_callback(xorriso, "bytes", xorriso->pacifier_count, 0, Xorriso_pacifier_callback(xorriso, "bytes", xorriso->pacifier_count, 0,
"", 8 | 1<<6); "", 8 | 1<<6);
} }
} }
if(use_md5) { if(use_md5) {
ret= Xorriso_md5_end(xorriso, &ctx, disk_md5, 0); ret= Xorriso_md5_end(xorriso, &ctx, disk_md5, 0);
skipping to change at line 230 skipping to change at line 231
} }
for(i= 0; i < 16; i++) for(i= 0; i < 16; i++)
if(iso_md5[i] != disk_md5[i]) if(iso_md5[i] != disk_md5[i])
break; break;
if(i < 16 ) { if(i < 16 ) {
offset_text[0]= 0; offset_text[0]= 0;
if(offset>0) if(offset>0)
sprintf(offset_text, "%.f+", (double) offset); sprintf(offset_text, "%.f+", (double) offset);
sprintf(respt, "%s %s : differs by MD5 sums.\n", sprintf(respt, "%s %s : differs by MD5 sums.\n",
common_adr, (flag&1 ? "CONTENT": "content")); common_adr, (flag&1 ? "CONTENT": "content"));
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= (1<<15); (*result)|= (1<<15);
} }
} else if(diffcount>0 || r1count!=r2count) { } else if(diffcount>0 || r1count!=r2count) {
if(first_diff<0) if(first_diff<0)
first_diff= (r1count>r2count ? r2count : r1count); first_diff= (r1count>r2count ? r2count : r1count);
offset_text[0]= 0; offset_text[0]= 0;
if(offset>0) if(offset>0)
sprintf(offset_text, "%.f+", (double) offset); sprintf(offset_text, "%.f+", (double) offset);
if(r1count > r2count)
dcount= diffcount + (r1count - r2count);
else
dcount= diffcount + (r2count - r1count);
sprintf(respt, "%s %s : differs by at least %.f bytes. First at %s%.f\n", sprintf(respt, "%s %s : differs by at least %.f bytes. First at %s%.f\n",
common_adr, (flag&1 ? "CONTENT": "content"), common_adr, (flag&1 ? "CONTENT": "content"),
(double) (diffcount + abs(r1count-r2count)), dcount, offset_text, (double) first_diff);
offset_text, (double) first_diff); if(!(flag&(1u<<31)))
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= (1<<15); (*result)|= (1<<15);
} }
if(fd1!=-1) if(fd1!=-1)
close(fd1); close(fd1);
if(! use_md5) if(! use_md5)
Xorriso_iso_file_close(xorriso, &stream2, 0); Xorriso_iso_file_close(xorriso, &stream2, 0);
if(was_error) if(was_error)
{ret= -1; goto ex;} {ret= -1; goto ex;}
ret= 1; ret= 1;
skipping to change at line 336 skipping to change at line 340
*result= 0; *result= 0;
respt= xorriso->result_line; respt= xorriso->result_line;
if(!(xorriso->disk_excl_mode&8)) { if(!(xorriso->disk_excl_mode&8)) {
ret= Xorriso_path_is_excluded(xorriso, disk_adr, 2 | !!(flag&(1<<27))); ret= Xorriso_path_is_excluded(xorriso, disk_adr, 2 | !!(flag&(1<<27)));
if(ret>0) { if(ret>0) {
strcpy(respt, "? "); strcpy(respt, "? ");
Text_shellsafe(disk_adr, respt, 1); Text_shellsafe(disk_adr, respt, 1);
sprintf(respt + strlen(respt), " (DISK) : exluded by %s\n", sprintf(respt + strlen(respt), " (DISK) : exluded by %s\n",
(ret==1 ? "-not_paths" : "-not_leaf")); (ret==1 ? "-not_paths" : "-not_leaf"));
if(! (flag & ((1 << 31) | (1 << 26)))) if(! (flag & ((1u << 31) | (1 << 26))))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
missing= 1; missing= 1;
(*result)|= 1; (*result)|= 1;
} }
} }
if(!missing) { if(!missing) {
if(flag&(1<<28)) if(flag&(1<<28))
ret= stat(disk_adr, &s1); ret= stat(disk_adr, &s1);
else else
ret= lstat(disk_adr, &s1); ret= lstat(disk_adr, &s1);
if(ret==-1) { if(ret==-1) {
strcpy(respt, "? "); strcpy(respt, "? ");
Text_shellsafe(disk_adr, respt, 1); Text_shellsafe(disk_adr, respt, 1);
sprintf(respt + strlen(respt), sprintf(respt + strlen(respt),
" (DISK) : cannot lstat() : %s\n", strerror(errno)); " (DISK) : cannot lstat() : %s\n", strerror(errno));
if(! (flag & ((1 << 31) | (1 << 26)))) if(! (flag & ((1u << 31) | (1 << 26))))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
missing= 1; missing= 1;
(*result)|= 1; (*result)|= 1;
} }
} }
if(missing) if(missing)
strcpy(a, "?"); strcpy(a, "?");
else else
strcpy(a, Ftypetxt(s1.st_mode, 1)); strcpy(a, Ftypetxt(s1.st_mode, 1));
strcat(a, " "); strcat(a, " ");
skipping to change at line 381 skipping to change at line 385
} }
strcat(a, " :"); strcat(a, " :");
if(flag&(1<<30)) if(flag&(1<<30))
a[0]= 0; a[0]= 0;
ret= Xorriso_iso_lstat(xorriso, iso_adr, &s2, 0); ret= Xorriso_iso_lstat(xorriso, iso_adr, &s2, 0);
if(ret<0) { if(ret<0) {
strcpy(respt, "? "); strcpy(respt, "? ");
Text_shellsafe(iso_adr, respt, 1); Text_shellsafe(iso_adr, respt, 1);
strcat(respt, " (ISO) : cannot find this file in ISO image\n"); strcat(respt, " (ISO) : cannot find this file in ISO image\n");
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
missing= 1; missing= 1;
(*result)|= 2; (*result)|= 2;
} }
if((flag&4)||missing) if((flag&4)||missing)
{ret= !missing; goto ex;} {ret= !missing; goto ex;}
/* Splitfile parts */ /* Splitfile parts */
if((S_ISREG(s1.st_mode) || S_ISBLK(s1.st_mode)) && S_ISDIR(s2.st_mode)) { if((S_ISREG(s1.st_mode) || S_ISBLK(s1.st_mode)) && S_ISDIR(s2.st_mode)) {
skipping to change at line 406 skipping to change at line 410
else else
is_split= 0; is_split= 0;
} }
/* Attributes */ /* Attributes */
if(s1.st_mode != s2.st_mode) { if(s1.st_mode != s2.st_mode) {
if((s1.st_mode&~S_IFMT)!=(s2.st_mode&~S_IFMT)) { if((s1.st_mode&~S_IFMT)!=(s2.st_mode&~S_IFMT)) {
sprintf(respt, "%s st_mode : %7.7o <> %7.7o\n", sprintf(respt, "%s st_mode : %7.7o <> %7.7o\n",
a, (unsigned int) (s1.st_mode & ~S_IFMT), a, (unsigned int) (s1.st_mode & ~S_IFMT),
(unsigned int) (s2.st_mode & ~S_IFMT)); (unsigned int) (s2.st_mode & ~S_IFMT));
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 4; (*result)|= 4;
} }
if((s1.st_mode&S_IFMT)!=(s2.st_mode&S_IFMT)) { if((s1.st_mode&S_IFMT)!=(s2.st_mode&S_IFMT)) {
sprintf(respt, "%s type : %s <> %s\n", sprintf(respt, "%s type : %s <> %s\n",
a, Ftypetxt(s1.st_mode, 0), Ftypetxt(s2.st_mode, 0)); a, Ftypetxt(s1.st_mode, 0), Ftypetxt(s2.st_mode, 0));
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 8; (*result)|= 8;
if((s1.st_mode&S_IFMT) == S_IFLNK) { if((s1.st_mode&S_IFMT) == S_IFLNK) {
/* check whether link target type matches */ /* check whether link target type matches */
ret= stat(disk_adr, &stbuf); ret= stat(disk_adr, &stbuf);
if(ret!=-1) if(ret!=-1)
if(S_ISDIR(stbuf.st_mode) && S_ISDIR(s2.st_mode)) if(S_ISDIR(stbuf.st_mode) && S_ISDIR(s2.st_mode))
(*result)|= (1<<16); (*result)|= (1<<16);
} }
} }
skipping to change at line 454 skipping to change at line 458
if(ret == 0) if(ret == 0)
(*result)|= 4 | (1 << 19); (*result)|= 4 | (1 << 19);
ret= Compare_text_lines(d1_acl, d2_acl, &diff_count, 1); ret= Compare_text_lines(d1_acl, d2_acl, &diff_count, 1);
if(ret < 0) if(ret < 0)
goto ex; goto ex;
if(ret == 0) if(ret == 0)
(*result)|= 4 | (1 << 19); (*result)|= 4 | (1 << 19);
if((*result) & (1 << 19)) { if((*result) & (1 << 19)) {
sprintf(respt, "%s ACL : %d difference%s\n", sprintf(respt, "%s ACL : %d difference%s\n",
a, diff_count, diff_count == 1 ? "" : "s"); a, diff_count, diff_count == 1 ? "" : "s");
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
} }
/* xattr */ /* xattr */
if(xorriso->do_aaip & 12) { if(xorriso->do_aaip & 12) {
ret= Xorriso_getfattr(xorriso, NULL, disk_adr, &attrlist1, ret= Xorriso_getfattr(xorriso, NULL, disk_adr, &attrlist1,
1 | 2 | ((flag & (1 << 28)) >> 23)); 1 | 2 | ((flag & (1 << 28)) >> 23));
if(ret < 0) if(ret < 0)
goto ex; goto ex;
ret= Xorriso_getfattr(xorriso, NULL, iso_adr, &attrlist2, 1); ret= Xorriso_getfattr(xorriso, NULL, iso_adr, &attrlist2, 1);
if(ret < 0) if(ret < 0)
goto ex; goto ex;
ret= Compare_text_lines(attrlist1, attrlist2, &diff_count, 0); ret= Compare_text_lines(attrlist1, attrlist2, &diff_count, 0);
if(ret < 0) if(ret < 0)
goto ex; goto ex;
if(ret == 0) { if(ret == 0) {
(*result)|= (1 << 20); (*result)|= (1 << 20);
sprintf(respt, "%s xattr : %d difference%s\n", sprintf(respt, "%s xattr : %d difference%s\n",
a, diff_count, diff_count == 1 ? "" : "s"); a, diff_count, diff_count == 1 ? "" : "s");
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
} }
if(s1.st_uid != s2.st_uid) { if(s1.st_uid != s2.st_uid) {
sprintf(respt, "%s st_uid : %lu <> %lu\n", a, sprintf(respt, "%s st_uid : %lu <> %lu\n", a,
(unsigned long) s1.st_uid, (unsigned long) s2.st_uid); (unsigned long) s1.st_uid, (unsigned long) s2.st_uid);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 16; (*result)|= 16;
} }
if(s1.st_gid != s2.st_gid) { if(s1.st_gid != s2.st_gid) {
sprintf(respt, "%s st_gid : %lu <> %lu\n", a, sprintf(respt, "%s st_gid : %lu <> %lu\n", a,
(unsigned long) s1.st_gid, (unsigned long) s2.st_gid); (unsigned long) s1.st_gid, (unsigned long) s2.st_gid);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 32; (*result)|= 32;
} }
if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) || if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) ||
(S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) { (S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) {
if(s1.st_rdev != s2.st_rdev) { if(s1.st_rdev != s2.st_rdev) {
sprintf(respt, "%s %s st_rdev : %lu <> %lu\n", a, sprintf(respt, "%s %s st_rdev : %lu <> %lu\n", a,
(S_ISCHR(s1.st_mode) ? "S_IFCHR" : "S_IFBLK"), (S_ISCHR(s1.st_mode) ? "S_IFCHR" : "S_IFBLK"),
(unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev); (unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 64; (*result)|= 64;
} }
} }
if((!(xorriso->do_aaip & 32)) && if((!(xorriso->do_aaip & 32)) &&
S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) { S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) {
sprintf(respt, "%s st_size : %.f <> %.f diff= %.f\n", sprintf(respt, "%s st_size : %.f <> %.f diff= %.f\n",
a, (double) s1.st_size, (double) s2.st_size, a, (double) s1.st_size, (double) s2.st_size,
((double) s1.st_size) - (double) s2.st_size); ((double) s1.st_size) - (double) s2.st_size);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 128; (*result)|= 128;
} }
if(s1.st_mtime != s2.st_mtime) { if(s1.st_mtime != s2.st_mtime) {
sprintf(respt, "%s st_mtime : %s <> %s diff= %.f s\n", sprintf(respt, "%s st_mtime : %s <> %s diff= %.f s\n",
a, Ftimetxt(s1.st_mtime, ttx1, 0), a, Ftimetxt(s1.st_mtime, ttx1, 0),
Ftimetxt(s2.st_mtime, ttx2, 0), Ftimetxt(s2.st_mtime, ttx2, 0),
((double) s1.st_mtime) - (double) s2.st_mtime); ((double) s1.st_mtime) - (double) s2.st_mtime);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 256; (*result)|= 256;
} }
if(flag&1) { if(flag&1) {
if(s1.st_atime != s2.st_atime) { if(s1.st_atime != s2.st_atime) {
sprintf(respt, "%s st_atime : %s <> %s diff= %.f s\n", sprintf(respt, "%s st_atime : %s <> %s diff= %.f s\n",
a, Ftimetxt(s1.st_atime, ttx1, 0), a, Ftimetxt(s1.st_atime, ttx1, 0),
Ftimetxt(s2.st_atime, ttx2, 0), Ftimetxt(s2.st_atime, ttx2, 0),
((double) s1.st_atime) - (double) s2.st_atime); ((double) s1.st_atime) - (double) s2.st_atime);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 512; (*result)|= 512;
} }
} }
if(flag&2) { if(flag&2) {
if(s1.st_ctime != s2.st_ctime) { if(s1.st_ctime != s2.st_ctime) {
sprintf(respt, "%s st_ctime : %s <> %s diff= %.f s\n", sprintf(respt, "%s st_ctime : %s <> %s diff= %.f s\n",
a, Ftimetxt(s1.st_ctime, ttx1, 0), a, Ftimetxt(s1.st_ctime, ttx1, 0),
Ftimetxt(s2.st_ctime, ttx2, 0), Ftimetxt(s2.st_ctime, ttx2, 0),
((double) s1.st_ctime) - (double) s2.st_ctime); ((double) s1.st_ctime) - (double) s2.st_ctime);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= 1024; (*result)|= 1024;
} }
} }
if(xorriso->isofs_st_in > 0 && if(xorriso->isofs_st_in > 0 &&
(xorriso->isofs_st_in <= s2.st_mtime || (xorriso->isofs_st_in <= s2.st_mtime ||
((flag & 1) && xorriso->isofs_st_in <= s2.st_atime) || ((flag & 1) && xorriso->isofs_st_in <= s2.st_atime) ||
((flag & 2) && xorriso->isofs_st_in <= s2.st_ctime))) ((flag & 2) && xorriso->isofs_st_in <= s2.st_ctime)))
(*result)|= 1 << 23; (*result)|= 1 << 23;
skipping to change at line 569 skipping to change at line 573
} else if(ret == 0) { /* match */ } else if(ret == 0) { /* match */
if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){ if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){
if(xorriso->do_aaip & 32) if(xorriso->do_aaip & 32)
content_shortcut= 1; content_shortcut= 1;
if((*result) & (8 | 128 | 256 | 512 | 1024 | (1 << 23))) { if((*result) & (8 | 128 | 256 | 512 | 1024 | (1 << 23))) {
(*result)|= (1 << 15); /* content bytes differ */ (*result)|= (1 << 15); /* content bytes differ */
if(((*result) & (1 << 23)) && if(((*result) & (1 << 23)) &&
!((*result) & (8 | 128 | 256 | 512 | 1024))) { !((*result) & (8 | 128 | 256 | 512 | 1024))) {
sprintf(respt, sprintf(respt,
"%s content : node timestamp younger than image timestamp\n", a); "%s content : node timestamp younger than image timestamp\n", a);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
stamp= s2.st_mtime; stamp= s2.st_mtime;
if((flag & 1) && s2.st_atime >= stamp) if((flag & 1) && s2.st_atime >= stamp)
stamp= s2.st_atime; stamp= s2.st_atime;
if((flag & 2) && s2.st_ctime >= stamp) if((flag & 2) && s2.st_ctime >= stamp)
stamp= s2.st_ctime; stamp= s2.st_ctime;
sprintf(respt, "%s content : %s > %s diff= %.f s\n", sprintf(respt, "%s content : %s > %s diff= %.f s\n",
a, Ftimetxt(stamp, ttx1, 3 << 1), a, Ftimetxt(stamp, ttx1, 3 << 1),
Ftimetxt(xorriso->isofs_st_in, ttx2, 3 << 1), Ftimetxt(xorriso->isofs_st_in, ttx2, 3 << 1),
((double) stamp) - (double) xorriso->isofs_st_in); ((double) stamp) - (double) xorriso->isofs_st_in);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
sprintf(respt, sprintf(respt,
"%s content : assuming inequality due to size or timestamps\n", a); "%s content : assuming inequality due to size or timestamps\n", a);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
} }
} else if(ret == 1) { /* mismatch */ } else if(ret == 1) { /* mismatch */
(*result)|= (1 << 21); (*result)|= (1 << 21);
sprintf(respt, "%s dev_ino : differing\n", a); sprintf(respt, "%s dev_ino : differing\n", a);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){ if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){
if(xorriso->do_aaip & 32) if(xorriso->do_aaip & 32)
content_shortcut= 1; content_shortcut= 1;
(*result)|= (1 << 15); /* content bytes differ */ (*result)|= (1 << 15); /* content bytes differ */
sprintf(respt, sprintf(respt,
"%s content : assuming inequality after dev_ino mismatch\n", a); "%s content : assuming inequality after dev_ino mismatch\n", a);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
} else { } else {
sprintf(respt, "%s dev_ino : no dev_ino stored with image node\n", a); sprintf(respt, "%s dev_ino : no dev_ino stored with image node\n", a);
if((xorriso->do_aaip & 32) && !(flag&(1<<31))) if((xorriso->do_aaip & 32) && !(flag&(1u<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
(*result)|= (1 << 22); (*result)|= (1 << 22);
} }
} }
if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && !content_shortcut) { if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && !content_shortcut) {
/* Content */ /* Content */
if(is_split) { if(is_split) {
for(i= 0; i<split_count; i++) { for(i= 0; i<split_count; i++) {
Splitparts_get(split_parts, i, &part_name, &partno, &total_parts, Splitparts_get(split_parts, i, &part_name, &partno, &total_parts,
skipping to change at line 630 skipping to change at line 634
Xorriso_much_too_long(xorriso, strlen(iso_adr)+strlen(part_name)+1, Xorriso_much_too_long(xorriso, strlen(iso_adr)+strlen(part_name)+1,
2); 2);
{ret= -1; goto ex;} {ret= -1; goto ex;}
} }
ret= Xorriso_iso_lstat(xorriso, part_path, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, part_path, &stbuf, 0);
if(ret<0) if(ret<0)
continue; continue;
ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size, ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size,
offset, bytes, offset, bytes,
part_path, stbuf.st_size, result, part_path, stbuf.st_size, result,
(s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1<<31)))); (s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1u<<31))));
if(ret<0) if(ret<0)
was_error= 1; was_error= 1;
} }
if(total_parts>0 && split_count!=total_parts) { if(total_parts>0 && split_count!=total_parts) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"- %s/* (ISO) : Not all split parts present (%d of %d)\n", "- %s/* (ISO) : Not all split parts present (%d of %d)\n",
iso_adr, split_count, total_parts); iso_adr, split_count, total_parts);
if(!(flag&(1<<31))) if(!(flag&(1u<<31)))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 1); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 1);
(*result)|= 1<<18; (*result)|= 1<<18;
} }
} else { } else {
ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size, ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size,
(off_t) 0, s1.st_size, (off_t) 0, s1.st_size,
iso_adr, s2.st_size, result, iso_adr, s2.st_size, result,
(s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1<<31)))); (s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1u<<31))));
if(ret<0) if(ret<0)
was_error= 1; was_error= 1;
} }
} }
if(was_error) if(was_error)
ret= -1; ret= -1;
else { else {
mask= ~((1 << 17) | (1 << 18) | (1 << 22) | (1 << 23)); mask= ~((1 << 17) | (1 << 18) | (1 << 22) | (1 << 23));
if(xorriso->do_aaip & 32) if(xorriso->do_aaip & 32)
skipping to change at line 740 skipping to change at line 744
ret= 0; ret= 0;
if(ret<0) if(ret<0)
goto ex; goto ex;
if(ret>0) if(ret>0)
{ret= 3; goto ex;} {ret= 3; goto ex;}
follow_links= (xorriso->do_follow_links || follow_links= (xorriso->do_follow_links ||
(xorriso->do_follow_param && !(flag&2))) <<28; (xorriso->do_follow_param && !(flag&2))) <<28;
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, "", &result, ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, "", &result,
2 | follow_links | ((!!(flag & 4)) << 26) 2 | follow_links | ((!!(flag & 4)) << 26)
| ((!(flag&2))<<27) | ((flag&1)<<31)); | ((!(flag&2))<<27) | (((unsigned)(flag&1))<<31));
/* was once: | ((!(flag&1))<<29) */ /* was once: | ((!(flag&1))<<29) */
if(ret<xorriso->find_compare_result) if(ret<xorriso->find_compare_result)
xorriso->find_compare_result= ret; xorriso->find_compare_result= ret;
if(flag&1) { if(flag&1) {
if(ret<0) if(ret<0)
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
goto ex; goto ex;
if(ret > 0) if(ret > 0)
result= 0; result= 0;
uret= Xorriso_update_interpreter(xorriso, boss_iter, node, result, uret= Xorriso_update_interpreter(xorriso, boss_iter, node, result,
skipping to change at line 792 skipping to change at line 796
int Xorriso_update_interpreter(struct XorrisO *xorriso, int Xorriso_update_interpreter(struct XorrisO *xorriso,
void *boss_iter, void *node, void *boss_iter, void *node,
int compare_result, char *disk_path, int compare_result, char *disk_path,
char *iso_rr_path, int flag) char *iso_rr_path, int flag)
{ {
int ret= 1, deleted= 0, is_split= 0, i, loop_count, late_hardlink_update= 0; int ret= 1, deleted= 0, is_split= 0, i, loop_count, late_hardlink_update= 0;
struct stat stbuf; struct stat stbuf;
struct SplitparT *split_parts= NULL; struct SplitparT *split_parts= NULL;
int split_count= 0; int split_count= 0;
char *part_path= NULL, *part_name; char *part_path= NULL, *part_name;
int partno, total_parts, new_total_parts; int partno, total_parts, new_total_parts, added_overwrote= 0;
off_t offset, bytes, total_bytes, disk_size, first_bytes; off_t offset, bytes, total_bytes, disk_size, first_bytes, du_size;
if((compare_result&3)==3) { if((compare_result&3)==3) {
sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path "); sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path ");
Text_shellsafe(disk_path, xorriso->info_text, 1); Text_shellsafe(disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
xorriso->find_compare_result= -1; xorriso->find_compare_result= -1;
ret= 3; goto ex; ret= 3; goto ex;
} }
Xorriso_alloc_meM(part_path, char, SfileadrL); Xorriso_alloc_meM(part_path, char, SfileadrL);
skipping to change at line 956 skipping to change at line 960
ret= Xorriso_hardlink_update(xorriso, &compare_result, ret= Xorriso_hardlink_update(xorriso, &compare_result,
disk_path, iso_rr_path, 1 | (flag & 4)); disk_path, iso_rr_path, 1 | (flag & 4));
if(ret < 0) if(ret < 0)
goto ex; goto ex;
} }
if(flag & 2) { if(flag & 2) {
ret= Xorriso_mark_update_merge(xorriso, iso_rr_path, NULL, 1); ret= Xorriso_mark_update_merge(xorriso, iso_rr_path, NULL, 1);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
} }
if(flag & 1) if(flag & 1) {
sprintf(xorriso->info_text, "Widened hard link "); sprintf(xorriso->info_text, "Widened hard link ");
else } else {
sprintf(xorriso->info_text, "Added/overwrote "); sprintf(xorriso->info_text, "Added/overwrote ");
added_overwrote= 1;
}
} else if(compare_result&(4|16|32|256|512|1024|(1<<19)|(1<<20)|(1<<22))) { } else if(compare_result&(4|16|32|256|512|1024|(1<<19)|(1<<20)|(1<<22))) {
/* access permissions, user id, group id, mtime, atime, ctime, ACL, xattr, /* access permissions, user id, group id, mtime, atime, ctime, ACL, xattr,
dev_ino missing */ dev_ino missing */
if(flag & 1) if(flag & 1)
goto overwrite; goto overwrite;
if(is_split) { if(is_split) {
ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL, ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL,
skipping to change at line 1002 skipping to change at line 1008
} else } else
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 4); ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 4);
sprintf(xorriso->info_text, "Adjusted attributes of "); sprintf(xorriso->info_text, "Adjusted attributes of ");
} else if(flag & 1) { } else if(flag & 1) {
goto overwrite; goto overwrite;
} else } else
ret= 1; ret= 1;
if(ret>0 && xorriso->info_text[0]) { if(ret>0 && xorriso->info_text[0]) {
Text_shellsafe(iso_rr_path, xorriso->info_text, 1); Text_shellsafe(iso_rr_path, xorriso->info_text, 1);
if(added_overwrote) {
ret= Xorriso_iso_lstat(xorriso, iso_rr_path, &stbuf, 0);
if(ret == 0 && S_ISREG(stbuf.st_mode)) {
strcat(xorriso->info_text, " (");
Sfile_scale((double) stbuf.st_size,
xorriso->info_text + strlen(xorriso->info_text), 5, 1e4,
1 | 2);
strcat(xorriso->info_text, ")");
} else if (ret == 0 && S_ISDIR(stbuf.st_mode)) {
ret= Xorriso_get_dus(xorriso, iso_rr_path, &du_size, (off_t) 0, 0);
if(ret > 0 && du_size > 0) {
strcat(xorriso->info_text, " (");
Sfile_scale((double) du_size,
xorriso->info_text + strlen(xorriso->info_text), 5, 1e4,
1 | 2);
strcat(xorriso->info_text, ")");
}
}
}
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
} }
ret= 1; ret= 1;
ex:; ex:;
if(split_parts!=NULL) if(split_parts!=NULL)
Splitparts_destroy(&split_parts, split_count, 0); Splitparts_destroy(&split_parts, split_count, 0);
Xorriso_free_meM(part_path); Xorriso_free_meM(part_path);
if(ret<=0) if(ret<=0)
return(ret); return(ret);
if(deleted) if(deleted)
 End of changes. 40 change blocks. 
39 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)