policy: NULL path isn't really acceptable - use the devname
According to:
commit b451aa4846
Fix handling for "auto" line in mdadm.conf
a NULL path isn't really acceptable and the devname should be used instead.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
2ca20929fa
commit
75a721fd7d
5
policy.c
5
policy.c
|
@ -200,10 +200,8 @@ static char *disk_path(struct mdinfo *disk)
|
|||
int rv;
|
||||
|
||||
by_path = opendir(symlink);
|
||||
if (!by_path)
|
||||
return NULL;
|
||||
if (by_path) {
|
||||
prefix_len = strlen(symlink);
|
||||
|
||||
while ((ent = readdir(by_path)) != NULL) {
|
||||
if (ent->d_type != DT_LNK)
|
||||
continue;
|
||||
|
@ -220,6 +218,7 @@ static char *disk_path(struct mdinfo *disk)
|
|||
return xstrdup(ent->d_name);
|
||||
}
|
||||
closedir(by_path);
|
||||
}
|
||||
/* A NULL path isn't really acceptable - use the devname.. */
|
||||
sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor);
|
||||
rv = readlink(symlink, nm, sizeof(nm)-1);
|
||||
|
|
Loading…
Reference in New Issue