Make sure sysfs_read never succeeds for a non-MD device.
... just in case.
This commit is contained in:
parent
aba69144fd
commit
2faf1f5f63
5
sysfs.c
5
sysfs.c
|
@ -76,7 +76,10 @@ struct sysarray *sysfs_read(int fd, int devnum, unsigned long options)
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
struct stat stb;
|
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)
|
if (major(stb.st_rdev)==9)
|
||||||
sprintf(sra->name, "md%d", minor(stb.st_rdev));
|
sprintf(sra->name, "md%d", minor(stb.st_rdev));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue