Corrected strange behavior with non-ISO images on overwriteable media

This commit is contained in:
2008-05-13 13:52:33 +00:00
parent 6bc2d3e0a3
commit 5f5b0c7016
7 changed files with 38 additions and 18 deletions

View File

@ -485,6 +485,8 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast)
{
int ret;
struct isoburn *o;
enum burn_disc_status s;
char zero_buffer[Libisoburn_target_head_sizE];
ret= isoburn_find_emulator(&o, drive, 0);
if(ret>0) {
@ -494,9 +496,16 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast)
return;
}
if(o->emulation_mode>0) {
ret= isoburn_invalidate_iso(o, 0);
s= isoburn_disc_get_status(drive);
if(s==BURN_DISC_FULL) { /* unknown data format in first 64 kB */
memset(zero_buffer, 0, Libisoburn_target_head_sizE);
ret= burn_random_access_write(drive, (off_t) 0, zero_buffer,
(off_t) Libisoburn_target_head_sizE, 1);
} else {
ret= isoburn_invalidate_iso(o, 0);
}
if(ret<=0)
burn_drive_cancel(drive);
burn_drive_cancel(drive); /* mark run as failure */
return;
}
}
@ -510,12 +519,16 @@ off_t isoburn_disc_available_space(struct burn_drive *d,
int ret;
struct isoburn *o;
struct burn_write_opts *eff_opts= NULL, *local_opts= NULL;
enum burn_disc_status s;
off_t avail;
eff_opts= opts;
ret= isoburn_find_emulator(&o, d, 0);
if(ret>0 && o!=NULL)
if(o->emulation_mode!=0) {
s= isoburn_disc_get_status(d);
if(s==BURN_DISC_FULL) /* unknown data format in first 64 kB */
return((off_t) 0);
local_opts= burn_write_opts_new(d);
eff_opts= local_opts;
burn_write_opts_set_start_byte(eff_opts, ((off_t) o->nwa) * (off_t) 2048);