Make sure sysfs_read never succeeds for a non-MD device.

... just in case.
This commit is contained in:
Neil Brown 2007-12-14 20:13:51 +11:00
parent aba69144fd
commit 2faf1f5f63
1 changed files with 4 additions and 1 deletions

View File

@ -76,7 +76,10 @@ struct sysarray *sysfs_read(int fd, int devnum, unsigned long options)
if (fd >= 0) {
struct stat stb;
if (fstat(fd, &stb)) return NULL;
mdu_version_t vers;
if (fstat(fd, &stb)) return NULL;
if (ioctl(fd, RAID_VERSION, &vers) != 0)
return NULL;
if (major(stb.st_rdev)==9)
sprintf(sra->name, "md%d", minor(stb.st_rdev));
else