Do not believe libburn if it says a role 2 drive is empty

This commit is contained in:
2010-01-01 12:56:12 +00:00
parent 45277ed62b
commit ea9cb3ab4b
3 changed files with 28 additions and 10 deletions

View File

@ -6,7 +6,7 @@
/*
libisofs related functions of libisoburn.
Copyright 2007 - 2009 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
Copyright 2007 - 2010 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
Thomas Schmitt <scdbackup@gmx.net>
*/
@ -307,7 +307,7 @@ int isoburn_activate_session(struct burn_drive *drive)
*/
int isoburn_start_emulation(struct isoburn *o, int flag)
{
int ret, i, capacity = -1;
int ret, i, capacity = -1, role;
off_t data_count, to_read;
struct burn_drive *drive;
struct ecma119_pri_vol_desc *pvm;
@ -324,11 +324,14 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* We can assume 0 as start block for image.
The data there point to the most recent session.
*/
role = burn_drive_get_drive_role(drive);
ret = burn_get_read_capacity(drive, &capacity, 0);
if (ret > 0 && capacity > 0) {
if ((ret > 0 && capacity > 0) || role == 2) {
/* Might be a block device on a system where libburn cannot determine its
size. Try to read anyway. */
memset(o->target_iso_head, 0, Libisoburn_target_head_sizE);
to_read = Libisoburn_target_head_sizE;
if((off_t) capacity * (off_t) 2048 < to_read)
if(capacity > 0 && (off_t) capacity * (off_t) 2048 < to_read)
to_read = (off_t) capacity * (off_t) 2048;
ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head,
to_read, &data_count, 2);