Avoided to use MD5 on filtered streams with compare and update

This commit is contained in:
Thomas Schmitt 2009-09-07 16:11:46 +00:00
parent 3c25d5a163
commit e5145063f9
4 changed files with 21 additions and 6 deletions

View File

@ -7346,7 +7346,11 @@ cannot_address:;
if(xorriso->do_md5 & 16) {
use_md5= 1;
ret= Xorriso_get_md5(xorriso, NULL, iso_adr, iso_md5, 1);
ret= Xorriso_is_plain_image_file(xorriso, NULL, iso_adr, 0);
if(ret <= 0)
ret= 0; /* (reverse) filtered files are likely not to match their MD5 */
else
ret= Xorriso_get_md5(xorriso, NULL, iso_adr, iso_md5, 1);
if(ret <= 0)
use_md5= 0;
else {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.09.06.144813"
#define Xorriso_timestamP "2009.09.07.161247"

View File

@ -3625,11 +3625,19 @@ int Xorriso_restore_implicit_properties(struct XorrisO *xorriso,
}
int Xorriso_is_plain_image_file(struct XorrisO *xorriso, IsoNode *node,
int flag)
int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node,
char *path, int flag)
{
int ret, lba;
IsoStream *stream;
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);
}
ret= Xorriso__file_start_lba(node, &lba, 0);
if(ret > 0) { /* Stream source is from loaded image */
@ -3748,7 +3756,7 @@ int Xorriso_tree_restore_node(struct XorrisO *xorriso, IsoNode *node,
ret= Xorriso_iso_file_read(xorriso, data_stream, buf, wanted, 0);
if(ret<=0) {
if(xorriso->extract_error_mode == 0 &&
Xorriso_is_plain_image_file(xorriso, node, 0)) {
Xorriso_is_plain_image_file(xorriso, node, "", 0)) {
close(write_fd);
write_fd= -1;
already_done= (size - todo) / (off_t) 2048;
@ -10118,7 +10126,7 @@ int Xorriso_extract_cut(struct XorrisO *xorriso,
}
read_raw= 0;
if((img_offset % 2048) == 0) {
ret= Xorriso_is_plain_image_file(xorriso, node, 0);
ret= Xorriso_is_plain_image_file(xorriso, node, "", 0);
if(ret > 0)
read_raw= 1;
}

View File

@ -480,6 +480,9 @@ int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16],
*/
int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag);
int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node,
char *path, int flag);
/* A pseudo file type for El-Torito bootsectors as in man 2 stat :
For now take the highest possible value.