Made patch_lba0= more modest with overwriting.

This commit is contained in:
Thomas Schmitt 2010-06-16 14:03:46 +00:00
parent 8274b56b6b
commit 601b123b78
2 changed files with 26 additions and 21 deletions

View File

@ -1988,7 +1988,7 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
char *headpt;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
off_t seek_ret;
off_t seek_ret, to_write;
int tag_type;
uint32_t pos, range_start, range_size, next_tag;
char md5[16];
@ -2069,28 +2069,32 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
headpt[87-i]= headpt[80+i]= (full_size >> (8*i)) & 0xff;
/* Invalidate eventual libisofs checksum tags */
/* Look for volume descriptor end */
for(i= 16; i < 32; i++)
if(((unsigned char *) head_buffer)[i * 2048] == 0xff &&
strncmp(head_buffer + i * 2048 + 1, "CD001", 5) == 0)
break;
/* Check whether the next one is a libisofs checksum tag */
if(i < 32) {
i++;
ret= iso_util_decode_md5_tag(head_buffer + i * 2048, &tag_type, &pos,
&range_start, &range_size, &next_tag, md5, 0);
if(ret != 0) /* corrupted or not: invalidate */
memset(head_buffer + i * 2048, 0, 8);
}
if(job != NULL) {
/* This is a check_media superblock relocation:
Invalidate eventual libisofs checksum tags.
Write only up to PVD end plus eventual invalidated tag.
*/
/* Look for volume descriptor end */
for(i= 16; i < 32; i++)
if(((unsigned char *) head_buffer)[i * 2048] == 0xff &&
strncmp(head_buffer + i * 2048 + 1, "CD001", 5) == 0)
break;
/* Check whether the next one is a libisofs checksum tag */
if(i < 32) {
i++;
ret= iso_util_decode_md5_tag(head_buffer + i * 2048, &tag_type, &pos,
&range_start, &range_size, &next_tag, md5, 0);
if(ret != 0) /* corrupted or not: invalidate */
memset(head_buffer + i * 2048, 0, 8);
}
to_write= 2048 * (i + 1);
seek_ret= lseek(job->data_to_fd, (off_t) 0, SEEK_SET);
if(seek_ret == -1)
ret= 0;
else
ret= write(job->data_to_fd, head_buffer, 64 * 1024);
if(ret < 64 * 1024) {
ret= write(job->data_to_fd, head_buffer, to_write);
if(ret < to_write) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"Cannot write ISO image head to file copy");
@ -2098,8 +2102,9 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
return(0);
}
} else {
ret= burn_random_access_write(drive, (off_t) 0, head_buffer,
(off_t) (64*1024), 1);
/* This is a regular superblock relocation. Write full 64 kB. */
to_write= 64 * 1024;
ret= burn_random_access_write(drive, (off_t) 0, head_buffer, to_write, 1);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.06.16.105652"
#define Xorriso_timestamP "2010.06.16.140253"