--- 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);
 }
