Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jan 2009 09:27:04 -0200
From:      "Carlos A. M. dos Santos" <unixmania@gmail.com>
To:        "Giorgos Keramidas" <keramida@freebsd.org>
Cc:        Alexander Best <alexbestms@math.uni-muenster.de>, freebsd-current@freebsd.org, sos@freebsd.org
Subject:   Re: patch to fix burncd bug
Message-ID:  <e71790db0901090327s74ecc9c0te662091654ead9db@mail.gmail.com>
In-Reply-To: <87prixz9ne.fsf@kobe.laptop>
References:  <permail-200901081713146981cf3e00002177-a_best01@message-id.uni-muenster.de> <87prixz9ne.fsf@kobe.laptop>

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

[-- Attachment #1 --]
On Thu, Jan 8, 2009 at 8:59 PM, Giorgos Keramidas <keramida@freebsd.org> wrote:
> On Thu, 08 Jan 2009 18:13:14 +0100 (CET), Alexander Best <alexbestms@math.uni-muenster.de> wrote:
>> could somebody please commit the following patch to dev/ata? it fixes
>> a nasty bug during fixation in burncd. the bug exists in RELENG6,
>> RELENG7 and HEAD (and maybe RELENG5):
>>
>> http://www.freebsd.org/cgi/query-pr.cgi?prp=95979-3-txt&n=/patch
>>
>> the whole PR can be found here:
>> http://www.freebsd.org/cgi/query-pr.cgi?pr=95979
>
> I think Soren is the best person to look into this bug (Cc: added).
>
> Soren, what do you think?  Does the patch at bin/95979 look like a nice
> change to commit?  I just saw this PR so I haven't tried the patch on my
> laptop's CURRENT yet, but I can confirm that burning CD-ROMs and DVDs is
> busted in my laptop for a few weeks now.

I proposed a solution a similar problem (bin/123693), but patching
burncd instead of the kernel. I'm attaching the patch, for your
convenience.

-- 
cd /usr/ports/sysutils/life
make clean

[-- Attachment #2 --]
diff -durP burncd.orig/burncd.c burncd/burncd.c
--- burncd.orig/burncd.c	2005-05-13 17:06:44.000000000 -0300
+++ burncd/burncd.c	2008-05-26 00:51:31.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,15 @@
 		err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)");
 	}
 
-	if (eject)
-		if (ioctl(fd, CDIOCEJECT) < 0)
+	if (eject) {
+		int status, try = EJECT_TRIES, delay = 1;
+		while ((status = ioctl(fd, CDIOCEJECT)) < 0 && --try > 0) {
+			sleep(delay);
+			delay *= 2;
+		}
+		if (status < 0)
 			err(EX_IOERR, "ioctl(CDIOCEJECT)");
+	}
 	close(fd);
 	exit(EX_OK);
 }
Only in burncd.orig: burncd.c.orig

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