From 9efb046330173cc59de9c7aaa3af699e07db2fbc Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 3 Nov 2015 15:41:47 +0000 Subject: [PATCH] Made clear that a drive needs an isoburn object for writing. Coverity CID 28758. --- libisoburn/burn_wrap.c | 67 ++++++++++++++++++++----------------- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/libisoburn/burn_wrap.c b/libisoburn/burn_wrap.c index 77908fca..58ace2fc 100644 --- a/libisoburn/burn_wrap.c +++ b/libisoburn/burn_wrap.c @@ -920,40 +920,45 @@ void isoburn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc) ret= isoburn_find_emulator(&o, drive, 0); if(ret<0) goto ex; - if(o!=NULL) { - o->wrote_well= -1; - if(o->emulation_mode!=0) { - burn_write_opts_set_multi(opts, 0); - if(o->emulation_mode>0 && o->nwa >= 0) { - nwa= o->nwa; + if(o == NULL) { + sprintf(msg, + "Program error: Cannot find isoburn object associated to the drive"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + burn_drive_cancel(drive); + goto ex; + } + o->wrote_well= -1; + if(o->emulation_mode!=0) { + burn_write_opts_set_multi(opts, 0); + if(o->emulation_mode>0 && o->nwa >= 0) { + nwa= o->nwa; - /* This caters for unwritten formatted DVD-RW. They need to be written - sequentially on the first use. Only written areas are random access. - If the first session is not written to LBA 0, then re-opening of - formatting and padding is needed. - This can be done. But when the track gets closed after padding, - this lasts a long time. There is a high risk that an app will not - poll the message queue while waiting for isoburn_disc_write() to - return. The pacifier loop usually happens only afterwards. - So automatic formatting might cause a nervous clueless user. + /* This caters for unwritten formatted DVD-RW. They need to be written + sequentially on the first use. Only written areas are random access. + If the first session is not written to LBA 0, then re-opening of + formatting and padding is needed. + This can be done. But when the track gets closed after padding, + this lasts a long time. There is a high risk that an app will not + poll the message queue while waiting for isoburn_disc_write() to + return. The pacifier loop usually happens only afterwards. + So automatic formatting might cause a nervous clueless user. + */ + ret= isoburn_is_intermediate_dvd_rw(drive, 0); + if(ret>0 && nwa>0 && nwa <= o->zero_nwa) { + /* actually this should not happen since such media get recognized + by isoburn_welcome_media and o->zero_nwa gets set to 0 */ - ret= isoburn_is_intermediate_dvd_rw(drive, 0); - if(ret>0 && nwa>0 && nwa <= o->zero_nwa) { - /* actually this should not happen since such media get recognized - by isoburn_welcome_media and o->zero_nwa gets set to 0 - */ - sprintf(msg, - "DVD-RW insufficiently formatted. (Intermediate State, size unknown)"); - isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); - sprintf(msg, - "It might help to first deformat it and then format it again"); - isoburn_msgs_submit(o, 0x00060000, msg, 0, "HINT", 0); - burn_drive_cancel(drive); /* mark run as failure */ - goto ex; - } - /* end of DVD-RW oriented check */ - burn_write_opts_set_start_byte(opts, nwa * (off_t) 2048); + sprintf(msg, + "DVD-RW insufficiently formatted. (Intermediate State, size unknown)"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + sprintf(msg, + "It might help to first deformat it and then format it again"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "HINT", 0); + burn_drive_cancel(drive); /* mark run as failure */ + goto ex; } + /* end of DVD-RW oriented check */ + burn_write_opts_set_start_byte(opts, nwa * (off_t) 2048); } } diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index f870d305..3cac7759 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2015.11.03.150839" +#define Xorriso_timestamP "2015.11.03.154102"