Throw error if imported_iso interval would be overwritten by multi-session
This commit is contained in:
parent
cace41ec16
commit
028f9275d3
@ -2013,12 +2013,11 @@ int iso_interval_reader_keep(Ecma119Image *target,
|
|||||||
if (!target->opts->appendable)
|
if (!target->opts->appendable)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* --- From here on return either 1 or <0 --- */
|
||||||
|
|
||||||
/* multi-session write offset must be larger than interval end */
|
/* multi-session write offset must be larger than interval end */
|
||||||
if (target->opts->ms_block <= ivr->end_byte / BLOCK_SIZE)
|
if (target->opts->ms_block <= ivr->end_byte / BLOCK_SIZE)
|
||||||
|
return ISO_MULTI_OVER_IMPORTED;
|
||||||
/* >>> ??? return error ??? */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2036,6 +2035,8 @@ int iso_interval_reader_start_size(Ecma119Image *t, char *path,
|
|||||||
return ret;
|
return ret;
|
||||||
*start_byte = ivr->start_byte;
|
*start_byte = ivr->start_byte;
|
||||||
keep = iso_interval_reader_keep(t, ivr, 0);
|
keep = iso_interval_reader_keep(t, ivr, 0);
|
||||||
|
if (keep < 0)
|
||||||
|
return(keep);
|
||||||
iso_interval_reader_destroy(&ivr, 0);
|
iso_interval_reader_destroy(&ivr, 0);
|
||||||
return ISO_SUCCESS + (keep > 0);
|
return ISO_SUCCESS + (keep > 0);
|
||||||
}
|
}
|
||||||
@ -2066,7 +2067,10 @@ int iso_write_partition_file(Ecma119Image *target, char *path,
|
|||||||
&ivr, &byte_count, 0);
|
&ivr, &byte_count, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
if (iso_interval_reader_keep(target, ivr, 0)) {
|
ret = iso_interval_reader_keep(target, ivr, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
goto ex;
|
||||||
|
if (ret > 0) {
|
||||||
/* From imported_iso and for add-on session. Leave it in place. */
|
/* From imported_iso and for add-on session. Leave it in place. */
|
||||||
ret = ISO_SUCCESS;
|
ret = ISO_SUCCESS;
|
||||||
goto ex;
|
goto ex;
|
||||||
|
@ -8887,6 +8887,10 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
|
|||||||
(FAILURE, HIGH, -419) */
|
(FAILURE, HIGH, -419) */
|
||||||
#define ISO_SUSP_WRONG_CE_SIZE 0xE830FE5D
|
#define ISO_SUSP_WRONG_CE_SIZE 0xE830FE5D
|
||||||
|
|
||||||
|
/** Multi-session would overwrite imported_iso interval
|
||||||
|
(FAILURE, HIGH, -420) */
|
||||||
|
#define ISO_MULTI_OVER_IMPORTED 0xE830FE5C
|
||||||
|
|
||||||
|
|
||||||
/* Internal developer note:
|
/* Internal developer note:
|
||||||
Place new error codes directly above this comment.
|
Place new error codes directly above this comment.
|
||||||
|
@ -551,6 +551,8 @@ const char *iso_error_to_msg(int errcode)
|
|||||||
return "Unable to obtain root directory";
|
return "Unable to obtain root directory";
|
||||||
case ISO_SUSP_WRONG_CE_SIZE:
|
case ISO_SUSP_WRONG_CE_SIZE:
|
||||||
return "Zero sized, oversized, or mislocated SUSP CE area found";
|
return "Zero sized, oversized, or mislocated SUSP CE area found";
|
||||||
|
case ISO_MULTI_OVER_IMPORTED:
|
||||||
|
return "Multi-session would overwrite imported_iso interval";
|
||||||
default:
|
default:
|
||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,8 @@ static int compute_partition_size(Ecma119Image *t, char *disk_path,
|
|||||||
*size = (byte_count + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
*size = (byte_count + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||||
keep = iso_interval_reader_keep(t, ivr, 0);
|
keep = iso_interval_reader_keep(t, ivr, 0);
|
||||||
iso_interval_reader_destroy(&ivr, 0);
|
iso_interval_reader_destroy(&ivr, 0);
|
||||||
|
if (keep < 0)
|
||||||
|
return keep;
|
||||||
return ISO_SUCCESS + (keep > 0);
|
return ISO_SUCCESS + (keep > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user