Avoided FAILURE event with welcoming empty disk files

This commit is contained in:
Thomas Schmitt 2009-10-05 16:55:36 +00:00
parent f45a911e86
commit 6bed27753d
3 changed files with 15 additions and 6 deletions

View File

@ -1047,7 +1047,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba,
int *image_blocks, char *info, int flag)
{
unsigned char buffer[64*1024];
int ret, info_mode;
int ret, info_mode, capacity;
off_t data_count;
info_mode= flag&255;
@ -1055,8 +1055,12 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba,
if(flag&(1<<13)) {
memcpy(buffer, info, 64*1024);
} else {
ret = burn_get_read_capacity(d, &capacity, 0);
if(ret > 0 && (off_t) capacity * (off_t) 2048 >= (off_t) (64 * 1024)) {
ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer,
(off_t) 64*1024, &data_count, 2); /* no error messages */
} else
ret= 0;
if(ret<=0)
return(-1*!!(flag&(1<<15)));
if(info_mode==2)

View File

@ -307,7 +307,7 @@ int isoburn_activate_session(struct burn_drive *drive)
*/
int isoburn_start_emulation(struct isoburn *o, int flag)
{
int ret, i;
int ret, i, capacity;
off_t data_count;
struct burn_drive *drive;
struct ecma119_pri_vol_desc *pvm;
@ -323,8 +323,13 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* we can assume 0 as start block for image */
/* TODO what about ms? where we validate valid iso image in ms disc? */
ret = burn_get_read_capacity(drive, &capacity, 0);
if (ret > 0 &&
(off_t) capacity * (off_t) 2048 >= (off_t) Libisoburn_target_head_sizE) {
ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head,
(off_t) Libisoburn_target_head_sizE, &data_count, 2);
} else
ret = 0;
/* an error means an empty disc */
if (ret <= 0) {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.09.30.092640"
#define Xorriso_timestamP "2009.10.05.165632"