mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID:394 - plugins/usb: Fix probe for SCSI devices
The current USB plugin doesn't find my IPMI channel: # ipmitool -I usb mc info Error in USB session setup Unable to setup interface usb Error loading interface usb This is beacuse I have more than 8 scsi-generic devices that identify as AMI: # grep -c ^AMI /proc/scsi/sg/device_strs 13 So we end up hitting the max in FindG2CDROM, and abort without finding the actual IPMI endpoint (on my system, this is /dev/sg11). This change bumps that maximum up to 16. However, that means we hit another bug in scsiProbeNew, where if we hit the end of the file without completely filling the array, we return with an error. This change handles the EOF condition gracefully instead. Also, fp is never going to become NULL; we don't need to check for that condition. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
This commit is contained in:
parent
999cd0ad91
commit
607cfe6f47
@ -131,11 +131,7 @@ scsiProbeNew(int *num_ami_devices, int *sg_nos)
|
||||
while (1) {
|
||||
/* Read line by line and search for "AMI" */
|
||||
if (fgets(linebuf, 80, fp) == NULL) {
|
||||
if (fp != NULL) {
|
||||
fclose(fp);
|
||||
}
|
||||
/* Return 1 on error */
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sscanf(linebuf, "%s", vendor) == 1) {
|
||||
@ -151,9 +147,7 @@ scsiProbeNew(int *num_ami_devices, int *sg_nos)
|
||||
}
|
||||
|
||||
*num_ami_devices = numdevfound;
|
||||
if (fp != NULL) {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -268,8 +262,8 @@ FindG2CDROM(struct ipmi_intf *intf)
|
||||
{
|
||||
int err = 0;
|
||||
char device[256];
|
||||
int devarray[8];
|
||||
int numdev = 8;
|
||||
int devarray[16];
|
||||
int numdev = 16;
|
||||
int iter;
|
||||
err = scsiProbeNew(&numdev, devarray);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user