Made patch_lba0= more modest with overwriting.
This commit is contained in:
parent
b511fe46aa
commit
21b484f644
@ -1988,7 +1988,7 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
|
|||||||
char *headpt;
|
char *headpt;
|
||||||
struct burn_drive_info *dinfo;
|
struct burn_drive_info *dinfo;
|
||||||
struct burn_drive *drive;
|
struct burn_drive *drive;
|
||||||
off_t seek_ret;
|
off_t seek_ret, to_write;
|
||||||
int tag_type;
|
int tag_type;
|
||||||
uint32_t pos, range_start, range_size, next_tag;
|
uint32_t pos, range_start, range_size, next_tag;
|
||||||
char md5[16];
|
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;
|
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) {
|
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);
|
seek_ret= lseek(job->data_to_fd, (off_t) 0, SEEK_SET);
|
||||||
if(seek_ret == -1)
|
if(seek_ret == -1)
|
||||||
ret= 0;
|
ret= 0;
|
||||||
else
|
else
|
||||||
ret= write(job->data_to_fd, head_buffer, 64 * 1024);
|
ret= write(job->data_to_fd, head_buffer, to_write);
|
||||||
if(ret < 64 * 1024) {
|
if(ret < to_write) {
|
||||||
Xorriso_process_msg_queues(xorriso,0);
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"Cannot write ISO image head to file copy");
|
"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);
|
return(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret= burn_random_access_write(drive, (off_t) 0, head_buffer,
|
/* This is a regular superblock relocation. Write full 64 kB. */
|
||||||
(off_t) (64*1024), 1);
|
to_write= 64 * 1024;
|
||||||
|
ret= burn_random_access_write(drive, (off_t) 0, head_buffer, to_write, 1);
|
||||||
if(ret<=0) {
|
if(ret<=0) {
|
||||||
Xorriso_process_msg_queues(xorriso,0);
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2010.06.16.105652"
|
#define Xorriso_timestamP "2010.06.16.140253"
|
||||||
|
Loading…
Reference in New Issue
Block a user