Browse Source

Changed bug fix 615dc7e997 of Mar 30 13:51:21 2018 +0200

release-1.5.4.branch
Thomas Schmitt 3 years ago
parent
commit
c5a9cc56e3
  1. 24
      libisofs/ecma119.c
  2. 1
      libisofs/ecma119.h
  3. 7
      libisofs/system_area.c

24
libisofs/ecma119.c

@ -573,10 +573,8 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
vol.vol_desc_version[0] = 1;
strncpy_pad((char*)vol.system_id, system_id, 32);
strncpy_pad((char*)vol.volume_id, vol_id, 32);
if (t->pvd_size_is_total_size > 0) {
iso_bb(vol.vol_space_size,
t->total_size / 2048 + t->opts->ms_block - t->eff_partition_offset,
4);
if (t->pvd_size_is_total_size && t->eff_partition_offset <= 0) {
iso_bb(vol.vol_space_size, t->total_size / 2048, 4);
} else {
iso_bb(vol.vol_space_size,
t->vol_space_size - t->eff_partition_offset, 4);
@ -1417,8 +1415,7 @@ int write_head_part2(Ecma119Image *target, int *write_count, int flag)
target->partiton_offset from any LBA pointer.
*/
target->eff_partition_offset = target->opts->partition_offset;
if (target->pvd_size_is_total_size != -1)
target->pvd_size_is_total_size = 0;
target->pvd_size_is_total_size = 0;
for (i = 0; i < (int) target->nwriters; ++i) {
writer = target->writers[i];
/* Not all writers have an entry in the partion volume descriptor set.
@ -2450,6 +2447,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
int system_area_options = 0;
char *system_area = NULL;
int write_count = 0, write_count_mem;
uint32_t vol_space_size_mem;
off_t total_size_mem;
/* 1. Allocate target and attach a copy of in_opts there */
target = calloc(1, sizeof(Ecma119Image));
@ -3050,6 +3049,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
}
/* check if we need to provide a copy of volume descriptors */
vol_space_size_mem = target->vol_space_size;
if (opts->overwrite != NULL) {
/* opts->overwrite must be larger by partion_offset
@ -3061,12 +3061,15 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
* In the PVM to be written in the 16th sector of the disc, we
* need to specify the full size.
*/
target->vol_space_size = target->curblock;
target->vol_space_size += opts->ms_block;
/* System area and volume descriptors */
target->opts_overwrite = (char *) opts->overwrite;
total_size_mem = target->total_size;
target->total_size += target->opts->ms_block * BLOCK_SIZE;
ret = write_head_part1(target, &write_count, 1 | 2);
target->opts_overwrite = NULL;
target->total_size = total_size_mem;
if (ret < 0)
goto target_cleanup;
@ -3129,15 +3132,10 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
goto target_cleanup;
}
/* The possible urge to use the total image size as filesystem size
is fulfilled now. The session PVD should bear the usual size.
So ban pvd_size_is_total_size from being set again.
*/
target->pvd_size_is_total_size = -1;
}
/* This was possibly altered by above overwrite buffer production */
target->vol_space_size = target->curblock - opts->ms_block;
target->vol_space_size = vol_space_size_mem;
/*
*/

1
libisofs/ecma119.h

@ -588,7 +588,6 @@ struct ecma119_image
/* 1= write the total size into the PVD of the ISO,
* 0= write vol_space_size
* -1= write vol_space_size, do not set to 1 or 0
*/
int pvd_size_is_total_size;

7
libisofs/system_area.c

@ -2174,10 +2174,9 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
}
}
if (((((t->system_area_options >> 2) & 0x3f) == 0 &&
(t->system_area_options & 3) == 1) ||
t->opts->partition_offset > 0) &&
t->pvd_size_is_total_size != -1) {
if ((((t->system_area_options >> 2) & 0x3f) == 0 &&
(t->system_area_options & 3) == 1) ||
t->opts->partition_offset > 0) {
/* Protective MBR || partition offset
ISO will not be a partition or add-on session.
It can span the whole image.

Loading…
Cancel
Save