fix add_dev() handling of broken links
Resolves issues like: mdadm -Ss mdadm: unable to open /dev/md/r1: No such file or directory ...where /dev/md/r1 points to a removed device. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
ef70b9f4ef
commit
bf68e9d9ab
4
util.c
4
util.c
|
@ -467,8 +467,10 @@ int devlist_ready = 0;
|
||||||
int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
|
int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (S_ISLNK(stb->st_mode)) {
|
if (S_ISLNK(stb->st_mode)) {
|
||||||
stat(name, &st);
|
if (stat(name, &st) != 0)
|
||||||
|
return 0;
|
||||||
stb = &st;
|
stb = &st;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue