Fixed bug in sg_open_scsi_siblings() introduced with revision 802

This commit is contained in:
Thomas Schmitt 2007-04-10 08:31:04 +00:00
parent 159715ebaa
commit 047f9c75f5
2 changed files with 8 additions and 2 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.04.10.082229"
#define Cdrskin_timestamP "2007.04.10.083119"

View File

@ -433,11 +433,15 @@ static int sg_open_scsi_siblings(char *path, int driveno,
int i_host_no = -1, i_channel_no = -1, i_target_no = -1, i_lun_no = -1;
char msg[161], fname[81];
struct stat stbuf;
dev_t last_rdev = 0;
dev_t last_rdev = 0, path_rdev;
static char tldev[][81]= {"/dev/sr%d", "/dev/scd%d", "/dev/sg%d", ""};
/* ts A70609: removed "/dev/st%d" */
if(stat(path, &stbuf) == -1)
return 0;
path_rdev = stbuf.st_rdev;
sg_select_device_family();
if (linux_sg_device_family[0] == 0)
return 1;
@ -454,6 +458,8 @@ static int sg_open_scsi_siblings(char *path, int driveno,
for (i = 0; i < 32; i++) {
sprintf(fname, tldev[tld], i);
if(stat(fname, &stbuf) == -1)
continue;
if (path_rdev == stbuf.st_rdev)
continue;
if (*sibling_count > 0 && last_rdev == stbuf.st_rdev)
continue;