New -find action make_md5 to equip files from old images with MD5
This commit is contained in:
@ -7621,6 +7621,10 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
xorriso->find_check_md5_result|= 4;
|
||||
if(ret >= 0)
|
||||
ret= 1;
|
||||
} else if(action == 36) { /* make_md5 */
|
||||
ret = Xorriso_make_md5(xorriso, (void *) node, show_path, 0);
|
||||
if(ret >= 0)
|
||||
ret= 1;
|
||||
} else { /* includes : 15 in_iso */
|
||||
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
|
||||
Xorriso_result(xorriso, 0);
|
||||
@ -7969,7 +7973,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
if(action==1 || action==2 || action==3 || action==17 || action == 28 ||
|
||||
action == 32)
|
||||
hflag|= 2; /* need freedom to manipulate image */
|
||||
if(action==14 || action==17 || action == 28)
|
||||
if(action==14 || action==17 || action == 28 || action == 35 || action == 36)
|
||||
hflag|= 4; /* need LBA sorted iteration for good data reading performance */
|
||||
ret= Xorriso_findi_iter(xorriso, dir_node, &mem,
|
||||
&iter, &node_array, &node_count, &node_idx,
|
||||
@ -8180,7 +8184,6 @@ int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba,
|
||||
/* @param flag bit0= do not dive into trees
|
||||
bit1= do not perform job->action on resulting node array
|
||||
bit2= do not free node_array after all actions are done
|
||||
bit3= eventually issue MD5 mismatch event
|
||||
*/
|
||||
int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
off_t boss_mem, int filec, char **filev, int flag)
|
||||
@ -8194,8 +8197,6 @@ int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
|
||||
array_job.start_path= NULL;
|
||||
|
||||
if((flag & 8) && job->action == 35)
|
||||
xorriso->find_check_md5_result= 0;
|
||||
if(job->action>=9 && job->action<=13) { /* actions which have own findjobs */
|
||||
/* array_job replaces the hindmost job in the chain */
|
||||
for(hindmost= job; hindmost->subjob != NULL; hindmost= hindmost->subjob)
|
||||
@ -8293,15 +8294,13 @@ int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
|
||||
ret= Xorriso_findi_action(xorriso, hindmost, NULL, (off_t) 0,
|
||||
abs_path, abs_path, node, 0, 1);
|
||||
if(ret <= 0)
|
||||
if(ret <= 0 || xorriso->request_to_abort)
|
||||
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
ret= 1;
|
||||
ex:;
|
||||
if((flag & 8) && job->action == 35)
|
||||
Xorriso_report_md5_outcome(xorriso, job->target, 0);
|
||||
if(!(flag & (2 | 4)))
|
||||
Xorriso_destroy_node_array(xorriso, 0);
|
||||
if(hmboss != NULL)
|
||||
@ -12282,6 +12281,38 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_make_md5(struct XorrisO *xorriso, void *in_node, char *path,
|
||||
int flag)
|
||||
{
|
||||
int ret;
|
||||
off_t size;
|
||||
IsoNode *node;
|
||||
|
||||
node= (IsoNode *) in_node;
|
||||
if(node == NULL) {
|
||||
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
if(!LIBISO_ISREG(node))
|
||||
return(0);
|
||||
ret= iso_file_make_md5((IsoFile *) node, 0);
|
||||
size= iso_file_get_size((IsoFile *) node);
|
||||
xorriso->pacifier_count+= size;
|
||||
xorriso->pacifier_byte_count+= size;
|
||||
Xorriso_pacifier_callback(xorriso, "content bytes read",
|
||||
xorriso->pacifier_count, 0, "", 0);
|
||||
Xorriso_process_msg_queues(xorriso, 0);
|
||||
if(ret < 0) {
|
||||
Xorriso_report_iso_error(xorriso, "", ret,
|
||||
"Error when computing MD5", 0, "FAILURE", 1);
|
||||
return(0);
|
||||
}
|
||||
Xorriso_set_change_pending(xorriso, 1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param node Opaque handle to IsoNode which is to be inquired instead of path if it is not NULL.
|
||||
@param path is used as address if node is NULL.
|
||||
@param flag bit0= do not report to result but only indicate outcome
|
||||
|
Reference in New Issue
Block a user