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:
Dan Williams 2008-11-10 09:30:07 -07:00
parent ef70b9f4ef
commit bf68e9d9ab
1 changed files with 3 additions and 1 deletions

4
util.c
View File

@ -467,8 +467,10 @@ int devlist_ready = 0;
int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
{
struct stat st;
if (S_ISLNK(stb->st_mode)) {
stat(name, &st);
if (stat(name, &st) != 0)
return 0;
stb = &st;
}