projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.5.0
[debian/amanda]
/
changer-src
/
scsi-irix.c
diff --git
a/changer-src/scsi-irix.c
b/changer-src/scsi-irix.c
index 1e635c9e46811a7053969a896b19c0a4e45ad6a9..b747884d54f7d6d26d8842f9be00505e2a9b91d3 100644
(file)
--- a/
changer-src/scsi-irix.c
+++ b/
changer-src/scsi-irix.c
@@
-24,7
+24,7
@@
* file named AUTHORS, in the root directory of this distribution.
*/
/*
* file named AUTHORS, in the root directory of this distribution.
*/
/*
- * $Id: scsi-irix.c,v 1.
1.2.13.4.1.2.5 2003/01/26 19:20:5
7 martinea Exp $
+ * $Id: scsi-irix.c,v 1.
22 2005/10/15 13:20:4
7 martinea Exp $
*
* Interface to execute SCSI commands on an SGI Workstation
*
*
* Interface to execute SCSI commands on an SGI Workstation
*
@@
-62,7
+62,7
@@
void SCSI_OS_Version()
{
#ifndef lint
void SCSI_OS_Version()
{
#ifndef lint
- static char rcsid[] = "$Id: scsi-irix.c,v 1.
1.2.13.4.1.2.5 2003/01/26 19:20:5
7 martinea Exp $";
+ static char rcsid[] = "$Id: scsi-irix.c,v 1.
22 2005/10/15 13:20:4
7 martinea Exp $";
DebugPrint(DEBUG_INFO, SECTION_INFO, "scsi-os-layer: %s\n",rcsid);
#endif
}
DebugPrint(DEBUG_INFO, SECTION_INFO, "scsi-os-layer: %s\n",rcsid);
#endif
}
@@
-78,7
+78,7
@@
int SCSI_OpenDevice(int ip)
if (pDev[ip].inqdone == 0)
{
if (pDev[ip].inqdone == 0)
{
- if ((DeviceFD = open(pDev[ip].dev, O_RDWR | O_EXCL)) > 0)
+ if ((DeviceFD = open(pDev[ip].dev, O_RDWR | O_EXCL)) >
=
0)
{
pDev[ip].inqdone = 1; pDev[ip].SCSI = 0;
pDev[ip].avail = 1;
{
pDev[ip].inqdone = 1; pDev[ip].SCSI = 0;
pDev[ip].avail = 1;
@@
-135,7
+135,7
@@
int SCSI_OpenDevice(int ip)
return(0);
}
} else {
return(0);
}
} else {
- if ((DeviceFD = open(pDev[ip].dev, O_RDWR | O_EXCL)) > 0)
+ if ((DeviceFD = open(pDev[ip].dev, O_RDWR | O_EXCL)) >
=
0)
{
pDev[ip].fd = DeviceFD;
pDev[ip].devopen = 1;
{
pDev[ip].fd = DeviceFD;
pDev[ip].devopen = 1;
@@
-212,7
+212,14
@@
int SCSI_ExecuteCommand(int DeviceFD,
while (--retries > 0) {
if (pDev[DeviceFD].devopen == 0)
{
while (--retries > 0) {
if (pDev[DeviceFD].devopen == 0)
{
- SCSI_OpenDevice(DeviceFD);
+ if (SCSI_OpenDevice(DeviceFD) == 0)
+ {
+ dbprintf(("SCSI_ExecuteCommand could not open %s: %s\n",
+ pDev[DeviceFD].dev,
+ strerror(errno)));
+ sleep(1); /* Give device a little time befor retry */
+ continue;
+ }
}
Result = ioctl(pDev[DeviceFD].fd, DS_ENTER, &ds);
SCSI_CloseDevice(DeviceFD);
}
Result = ioctl(pDev[DeviceFD].fd, DS_ENTER, &ds);
SCSI_CloseDevice(DeviceFD);
@@
-273,7
+280,8
@@
int Tape_Ioctl ( int DeviceFD, int command)
if (pDev[DeviceFD].devopen == 0)
{
if (pDev[DeviceFD].devopen == 0)
{
- SCSI_OpenDevice(DeviceFD);
+ if (SCSI_OpenDevice(DeviceFD) == 0)
+ return(-1);
}
switch (command)
}
switch (command)
@@
-299,7
+307,8
@@
int Tape_Status( int DeviceFD)
if (pDev[DeviceFD].devopen == 0)
{
if (pDev[DeviceFD].devopen == 0)
{
- SCSI_OpenDevice(DeviceFD);
+ if (SCSI_OpenDevice(DeviceFD) == 0)
+ return(-1);
}
if (ioctl(pDev[DeviceFD].fd , MTIOCGET, &mtget) != 0)
}
if (ioctl(pDev[DeviceFD].fd , MTIOCGET, &mtget) != 0)
@@
-343,7
+352,11
@@
int ScanBus(int print)
extern int errno;
int count = 0;
extern int errno;
int count = 0;
- dir = opendir("/dev/scsi");
+ if ((dir = opendir("/dev/scsi")) == NULL)
+ {
+ dbprintf(("Can not read /dev/scsi: %s", strerror(errno)));
+ return 0;
+ }
while ((dirent = readdir(dir)) != NULL)
{
while ((dirent = readdir(dir)) != NULL)
{