Improvements about -update_r and -compare_r

This commit is contained in:
2008-03-04 18:08:14 +00:00
parent 7ba6078291
commit 544e6849ff
3 changed files with 65 additions and 22 deletions

View File

@ -7123,7 +7123,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
} else if(compare_result&(4|16|32|256|512|1024)) {
/* access permissions, user id, group id, mtime, atime, ctime */
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 0);
sprintf(xorriso->info_text, "Adjusted attributes ");
sprintf(xorriso->info_text, "Adjusted attributes of ");
} else
ret= 1;
@ -9992,8 +9992,11 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret, mem_pci, zero= 0, result, uret;
double mem_lut= 0.0;
double mem_lut= 0.0, start_time;
char *ipth, *argv[4];
struct stat stbuf;
start_time= Sfile_microtime(0);
ipth= iso_path;
if(ipth[0]==0)
@ -10008,23 +10011,30 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
if(flag&8) {
xorriso->find_compare_result= 1;
argv[0]= ipth;
argv[1]= "-exec";
argv[2]= "update";
argv[3]= disk_path;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
if(ret>0) {
argv[0]= disk_path;
ret= Xorriso_iso_lstat(xorriso, ipth, &stbuf, 0);
if(ret != -1) {
argv[0]= ipth;
argv[1]= "-exec";
argv[2]= "add_missing";
argv[3]= ipth;
argv[2]= "update";
argv[3]= disk_path;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
if(ret>0)
ret= xorriso->find_compare_result;
else
ret= -1;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
} else
ret= 1;
if(ret>0) {
ret= lstat(disk_path, &stbuf);
if(ret != -1) {
argv[0]= disk_path;
argv[1]= "-exec";
argv[2]= "add_missing";
argv[3]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
if(ret>0)
ret= xorriso->find_compare_result;
else
ret= -1;
}
} else
ret= -1;
} else {
@ -10044,13 +10054,15 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
xorriso->pacifier_count, 0, "", 1);
if(ret>0) {
sprintf(xorriso->result_line,
"No file object needed update.\n");
"No file object needed update.");
} else if(ret==0) {
sprintf(xorriso->result_line, "Differences detected and updated.\n");
sprintf(xorriso->result_line, "Differences detected and updated.");
} else {
sprintf(xorriso->result_line,
"Not ok. Comparison or update failed due to error.\n");
"Not ok. Comparison or update failed due to error.");
}
sprintf(xorriso->result_line+strlen(xorriso->result_line),
" (runtime %.1f s)\n", Sfile_microtime(0)-start_time);
if(flag&1)
Xorriso_result(xorriso,0);
if(ret<0)