summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cdrw/misc_scsi.c
diff options
context:
space:
mode:
authorrameshc <none@none>2005-11-01 05:05:24 -0800
committerrameshc <none@none>2005-11-01 05:05:24 -0800
commita2b4fdf6f9770a7725bfd41e7b3a92253e26645c (patch)
tree8705990001cb5b45b021f19a840ee9af3365139b /usr/src/cmd/cdrw/misc_scsi.c
parentde6a15ee5bac749223cdd3f3d02367ab582243ff (diff)
downloadillumos-gate-a2b4fdf6f9770a7725bfd41e7b3a92253e26645c.tar.gz
6237805 cdrw fails to read TOC after write simulation
6237817 cdrw -S blanks media
Diffstat (limited to 'usr/src/cmd/cdrw/misc_scsi.c')
-rw-r--r--usr/src/cmd/cdrw/misc_scsi.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/usr/src/cmd/cdrw/misc_scsi.c b/usr/src/cmd/cdrw/misc_scsi.c
index c6d7f43c1e..3729093f2b 100644
--- a/usr/src/cmd/cdrw/misc_scsi.c
+++ b/usr/src/cmd/cdrw/misc_scsi.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -735,6 +735,24 @@ write_init(int mode)
err_msg(gettext("Audio mode is only supported for CD media\n"));
exit(1);
}
+ if (simulation &&
+ check_device(target, CHECK_MEDIA_IS_NOT_BLANK) &&
+ !check_device(target, CHECK_MEDIA_IS_NOT_ERASABLE) &&
+ device_type != DVD_PLUS_W) {
+ /*
+ * If we were in simulation mode, and media wasn't blank,
+ * but medium was erasable, then cdrw goes to erase the
+ * contents of the media after the simulation writing in order
+ * to cleanup the ghost TOC (see write_fini() calls blank()).
+ * This is bad because it removes existing data if media was
+ * multi-session. Therefore, we no longer allow simulation
+ * writing if such condition is met. we don't blank the DVD+RW
+ * media, so DVD+RWs are fine.
+ */
+ err_msg(gettext(
+ "Cannot perform simulation for non-blank media\n"));
+ exit(1);
+ }
if (!prepare_for_write(target, mode, simulation, keep_disc_open)) {
/* l10n_NOTE : 'failed' as in Initializing device...failed */
@@ -828,10 +846,8 @@ write_fini(void)
* the drive re-initialize the media.
*/
- if (!vol_running) {
- blanking_type = "clear";
- blank();
- }
+ blanking_type = "clear_ghost";
+ blank();
}
/* l10n_NOTE : 'done' as in "Finishing up...done" */