Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 2008 02:19:04 -0300
From:      "Carlos A. M. dos Santos" <unixmania@gmail.com>
To:        freebsd-stable@freebsd.org
Subject:   burncd: ioctl(CDIOCEJECT): Input/output error
Message-ID:  <e71790db0805112219v21019de6h3f0cc2a36dfe2563@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hello,

I get "burncd: ioctl(CDIOCEJECT): Input/output error" each time I
attempt to blank a CDRW with

     burncd -f /dev/acd0 blank eject

I noticed that this does not happen when I write a data cd with

     burncd -f /dev/acd0 data cd-image.iso fixate eject

I have seen the same bahavior on 4 different computers that have
DVD-RW units. Applying the attached patch to
/usr/src/usr.sbin/burncd/burncd.c solves the problem. It make burncd
attempt to eject the CD five times, sleeping for one second after each
unccessful try. I'd like to get some opinions on this before
submitting a PR.

Thanks in advance.

-- 
Carlos A. M. dos Santos

[-- Attachment #2 --]
--- burncd.c.orig	2005-05-13 17:06:44.000000000 -0300
+++ burncd.c	2008-05-12 01:44:30.000000000 -0300
@@ -46,6 +46,7 @@
 #include <arpa/inet.h>
 
 #define BLOCKS	16
+#define EJECT_TRIES 5
 
 struct track_info {
 	int	file;
@@ -316,9 +317,13 @@
 		err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)");
 	}
 
-	if (eject)
-		if (ioctl(fd, CDIOCEJECT) < 0)
+	if (eject) {
+		int status, i = 0;
+		while ((status = ioctl(fd, CDIOCEJECT)) < 0 && ++i <= EJECT_TRIES)
+			sleep(1);
+		if (status < 0)
 			err(EX_IOERR, "ioctl(CDIOCEJECT)");
+	}
 	close(fd);
 	exit(EX_OK);
 }

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e71790db0805112219v21019de6h3f0cc2a36dfe2563>