Improved processing of system area in multi-session situations

This commit is contained in:
Thomas Schmitt 2014-10-28 14:04:37 +00:00
parent 726696747a
commit 8e4a7482f3
2 changed files with 56 additions and 57 deletions

View File

@ -339,6 +339,7 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
int flag) int flag)
{ {
int ret, options, system_area_options, iso_lba= -1, start_lba, image_blocks; int ret, options, system_area_options, iso_lba= -1, start_lba, image_blocks;
int sa_loaded;
char volid[33]; char volid[33];
FILE *fp= NULL; FILE *fp= NULL;
char *buf= NULL, *bufpt= NULL; char *buf= NULL, *bufpt= NULL;
@ -378,20 +379,20 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
} }
Xorriso_alloc_meM(buf, char, 32768); Xorriso_alloc_meM(buf, char, 32768);
system_area_options= xorriso->system_area_options;
memset(buf, 0, 32768); memset(buf, 0, 32768);
if(xorriso->system_area_disk_path[0] == 0) { system_area_options= xorriso->system_area_options;
if(xorriso->patch_system_area) { sa_loaded= iso_image_get_system_area(img, buf, &options, 0);
ret= iso_image_get_system_area(img, buf, &options, 0); if(sa_loaded < 0) {
if(ret == 0) {
goto do_set;
} else if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, "", ret, Xorriso_report_iso_error(xorriso, "", ret,
"Error when inquiring System Area data of ISO 9660 image", "Error when inquiring System Area data of ISO 9660 image",
0, "FAILURE", 1); 0, "FAILURE", 1);
{ret= 0; goto ex;} {ret= 0; goto ex;}
} else { } if(sa_loaded > 0)
bufpt= buf;
if(xorriso->system_area_disk_path[0] == 0) {
if(xorriso->patch_system_area && xorriso->system_area_options == 0 &&
sa_loaded > 0) {
system_area_options= xorriso->patch_system_area; system_area_options= xorriso->patch_system_area;
/* Check whether partition 1 ends at image end */; /* Check whether partition 1 ends at image end */;
ub= (unsigned char *) buf; ub= (unsigned char *) buf;
@ -418,9 +419,9 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
/* Check whether bytes 432-345 point to ElTorito LBA */ /* Check whether bytes 432-345 point to ElTorito LBA */
hd_lba= ub[432] | (ub[433] << 8) | (ub[434] << 16) | (ub[435] << 24); hd_lba= ub[432] | (ub[433] << 8) | (ub[434] << 16) | (ub[435] << 24);
ret= iso_image_get_boot_image(img, &bootimg, &bootimg_node, NULL); ret= iso_image_get_boot_image(img, &bootimg, &bootimg_node, NULL);
if(ret != 1) if(ret != 1) {
system_area_options= 0; system_area_options= 0;
else if(bootimg_node != NULL) { } else if(bootimg_node != NULL) {
Xorriso__file_start_lba((IsoNode *) bootimg_node, &(iso_lba), 0); Xorriso__file_start_lba((IsoNode *) bootimg_node, &(iso_lba), 0);
if(((off_t) iso_lba) * (off_t) 4 != hd_lba) if(((off_t) iso_lba) * (off_t) 4 != hd_lba)
system_area_options= 0; system_area_options= 0;
@ -432,15 +433,14 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
0, "DEBUG", 0); 0, "DEBUG", 0);
} }
} }
bufpt= buf;
ret= 1;
} else
ret= 0;
goto do_set;
}
if(strcmp(xorriso->system_area_disk_path, "/dev/zero") == 0)
{ret= 1; goto do_set;} {ret= 1; goto do_set;}
}
bufpt= buf;
if(strcmp(xorriso->system_area_disk_path, "/dev/zero") == 0) {
memset(buf, 0, 32768);
{ret= 1; goto do_set;}
}
ret= Xorriso_afile_fopen(xorriso, xorriso->system_area_disk_path, ret= Xorriso_afile_fopen(xorriso, xorriso->system_area_disk_path,
"rb", &fp, 2); "rb", &fp, 2);
if(ret <= 0) if(ret <= 0)
@ -455,7 +455,6 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive,
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
} }
bufpt= buf;
do_set:; do_set:;
if(ret > 0 && xorriso->system_area_disk_path[0]) { if(ret > 0 && xorriso->system_area_disk_path[0]) {
@ -1063,7 +1062,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
} }
} }
if(image!=NULL && !(flag&1)) { if(image!=NULL && !(flag&1)) {
if(xorriso->boot_count > 0) { if(xorriso->boot_count > 0 || freshly_bootable) {
/* Eventually rename boot catalog node to changed boot_image_cat_path */ /* Eventually rename boot catalog node to changed boot_image_cat_path */
if(is_bootable > 0) { if(is_bootable > 0) {
ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootcat_node, sfe, 0); ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootcat_node, sfe, 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2014.10.28.140220" #define Xorriso_timestamP "2014.10.28.140313"