imsm: only use the device name as a fallback when IMSM_DEVNAME_AS_SERIAL=1
Also ensure that the serial buffer is initialized. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
0c046afd06
commit
f9ba0ff124
|
@ -849,16 +849,14 @@ static int imsm_read_serial(int fd, char *devname,
|
|||
|
||||
memset(scsi_serial, 0, sizeof(scsi_serial));
|
||||
|
||||
if (imsm_env_devname_as_serial()) {
|
||||
char name[MAX_RAID_SERIAL_LEN];
|
||||
|
||||
fd2devname(fd, name);
|
||||
strcpy((char *) serial, name);
|
||||
rv = scsi_get_serial(fd, scsi_serial, sizeof(scsi_serial));
|
||||
|
||||
if (rv && imsm_env_devname_as_serial()) {
|
||||
memset(serial, 0, MAX_RAID_SERIAL_LEN);
|
||||
fd2devname(fd, (char *) serial);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = scsi_get_serial(fd, scsi_serial, sizeof(scsi_serial));
|
||||
|
||||
if (rv != 0) {
|
||||
if (devname)
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in New Issue