Imported Upstream version 0.72.4

This commit is contained in:
TANIGUCHI Takaki
2012-04-08 21:33:59 +09:00
parent cef31abc8c
commit 2f23ea4b4a
1170 changed files with 116562 additions and 55295 deletions

View File

@@ -1,5 +1,5 @@
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2011 Carsten Gnoerlich.
* Copyright (C) 2004-2012 Carsten Gnoerlich.
* Project home page: http://www.dvdisaster.com
* Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org
*
@@ -104,6 +104,7 @@ DeviceHandle* OpenDevice(char *device)
{ DeviceHandle *dh;
dh = g_malloc0(sizeof(DeviceHandle));
dh->senseSize = sizeof(Sense);
dh->fd = open(device, O_RDWR | O_NONBLOCK);
if(dh->fd < 0)
@@ -144,6 +145,7 @@ void CloseDevice(DeviceHandle *dh)
int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char *buf, int size, Sense *sense, int data_mode)
{ struct scsireq sc;
int sense_len;
int rc;
/* prepare the scsi request */
@@ -165,6 +167,7 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
break;
case DATA_NONE:
sc.flags = 0;
break;
default:
Stop("illegal data_mode: %d", data_mode);
}
@@ -172,7 +175,11 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
/* Send the request and save the sense data. */
rc = ioctl(dh->fd, SCIOCCOMMAND, &sc);
memcpy(sense, sc.sense, sc.senselen_used);
sense_len = sc.senselen_used;
if(sense_len > dh->senseSize)
sense_len = dh->senseSize;
memcpy(sense, sc.sense, sense_len);
/* See what we've got back */