diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-09-16 05:58:41 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-09-16 05:58:41 +0200 |
commit | f9ba0ff1241014b8cee9e929c565dfa3c6531fa8 (patch) | |
tree | 89b19af9f6888ce34fdd5ebebcb8fe228448db8e | |
parent | imsm: rectify map handling (diff) | |
download | mdadm-f9ba0ff1241014b8cee9e929c565dfa3c6531fa8.tar.xz mdadm-f9ba0ff1241014b8cee9e929c565dfa3c6531fa8.zip |
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>
-rw-r--r-- | super-intel.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/super-intel.c b/super-intel.c index c6b7be43..4b05fbed 100644 --- a/super-intel.c +++ b/super-intel.c @@ -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, |