--- cdrdao-1.1.9/scsilib/libscg/scsi-linux-sg.c	2004-06-07 03:04:12.000000000 +0200
+++ scsi-linux-sg.c	2004-12-24 15:16:39.000000000 +0100
@@ -102,7 +102,8 @@ static	char __sccsid[] =
  *	Choose your name instead of "schily" and make clear that the version
  *	string is related to a modified source.
  */
-LOCAL	char	_scg_trans_version[] = "scsi-linux-sg.c-1.83";	/* The version for this transport*/
+LOCAL char    _scg_auth_schily_rh[]   = "schily-RH";  /* The author for this module   */
+LOCAL char    _scg_trans_version[] = "scsi-linux-sg.c-1.83-ARCH-O_EXCL";        /* The version for this transport*/
 
 #ifndef	SCSI_IOCTL_GET_BUS_NUMBER
 #define	SCSI_IOCTL_GET_BUS_NUMBER 0x5386
@@ -172,6 +173,7 @@ struct scg_local {
 	long	xbufsize;
 	char	*xbuf;
 	char	*SCSIbuf;
+	short   scgcdfiles[MAX_SCG][MAX_TGT][MAX_LUN];
 #ifdef	USE_ATA
 	ata_buscookies	bc[MAX_SCHILLY_HOSTS];
 #endif
@@ -312,7 +314,7 @@ scgo_open(scgp, device)
 	char		devname[64];
 		BOOL	use_ata = FALSE;
 
-	if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) {
+    	if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) {
 		errno = EINVAL;
 		if (scgp->errstr)
 			js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE,
@@ -379,9 +381,11 @@ scgo_open(scgp, device)
 		for (b = 0; b < MAX_SCG; b++) {
 			scglocal(scgp)->buscookies[b] = (short)-1;
 			for (t = 0; t < MAX_TGT; t++) {
-				for (l = 0; l < MAX_LUN; l++)
+				for (l = 0; l < MAX_LUN; l++){
 					scglocal(scgp)->scgfiles[b][t][l] = (short)-1;
-			}
+					scglocal(scgp)->scgcdfiles[b][t][l] = (short)-1;
+				}
+	    		}
 		}
 	}
 
@@ -411,7 +415,7 @@ scanopen:
 			if (scgp->errstr)
 				js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE,
 							"Cannot open '/dev/hd*'");
-			if (errno != ENOENT && errno != ENXIO && errno != ENODEV) {
+			if (errno != ENOENT && errno != ENXIO && errno != ENODEV && errno != EACCES) {
 				if (scgp->errstr)
 					js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE,
 							"Cannot open '%s'", devname);
@@ -427,7 +431,7 @@ scanopen:
 				close(f);
 				continue;
 			}
-			sg_clearnblock(f);	/* Be very proper about this */
+    			sg_clearnblock(f);	/* Be very proper about this */
 			if (sg_setup(scgp, f, busno, tgt, tlun, i))
 				return (++nopen);
 			if (busno < 0 && tgt < 0 && tlun < 0)
