Completed find action check_md5
This commit is contained in:
@@ -7602,8 +7602,12 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
ret= 1;
|
||||
} else if(action == 35) { /* check_md5 */
|
||||
ret= Xorriso_check_md5(xorriso, (void *) node, show_path, 2);
|
||||
if(ret < xorriso->find_check_md5_result)
|
||||
xorriso->find_check_md5_result= ret;
|
||||
if(ret == 0)
|
||||
xorriso->find_check_md5_result|= 1;
|
||||
else if(ret < 0)
|
||||
xorriso->find_check_md5_result|= 2;
|
||||
else if(ret == 2)
|
||||
xorriso->find_check_md5_result|= 4;
|
||||
if(ret >= 0)
|
||||
ret= 1;
|
||||
} else { /* includes : 15 in_iso */
|
||||
@@ -8158,6 +8162,7 @@ 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)
|
||||
@@ -8171,6 +8176,8 @@ 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)
|
||||
@@ -8275,6 +8282,8 @@ int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
|
||||
ret= 1;
|
||||
ex:;
|
||||
if((flag & 8) && job->action == 35)
|
||||
Xorriso_report_m5_outcome(xorriso, job->target, 0);
|
||||
if(!(flag & (2 | 4)))
|
||||
Xorriso_destroy_node_array(xorriso, 0);
|
||||
if(hmboss != NULL)
|
||||
@@ -12096,7 +12105,8 @@ ex:;
|
||||
by return value
|
||||
bit1= silently ignore nodes without MD5
|
||||
bit2= do not only report mismatches but also matches
|
||||
@return 2= no MD5 attached to node
|
||||
@return 3= not a data file
|
||||
2= no MD5 attached to node
|
||||
1= ok, MD5 compared and matching
|
||||
0= not ok, MD5 mismatch
|
||||
<0= other error
|
||||
@@ -12116,21 +12126,21 @@ int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path,
|
||||
if(node == NULL) {
|
||||
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
{ret= -1; goto ex;}
|
||||
}
|
||||
if(!LIBISO_ISREG(node)) {
|
||||
strcpy(xorriso->info_text, "-check_md5: Not a data file: ");
|
||||
Text_shellsafe(path, xorriso->info_text, 1);
|
||||
if(!(flag & 2))
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
ret= 2; goto ex;
|
||||
ret= 3; goto ex;
|
||||
}
|
||||
file= (IsoFile *) node;
|
||||
|
||||
/* obtain MD5 */
|
||||
ret= Xorriso_get_volume(xorriso, &image, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
{ret= -1; goto ex;}
|
||||
ret= iso_file_get_md5(image, file, node_md5, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret < 0)
|
||||
|
Reference in New Issue
Block a user