]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
fix add_dev() handling of broken links
authorDan Williams <dan.j.williams@intel.com>
Mon, 10 Nov 2008 16:30:07 +0000 (09:30 -0700)
committerNeilBrown <neilb@suse.de>
Fri, 28 Nov 2008 00:30:02 +0000 (11:30 +1100)
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>
util.c

diff --git a/util.c b/util.c
index a50036c116a76c86c2205ac3c148de345d4e9b93..64100cff13e952ffa943ec26a40d76f46a4a666f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -433,8 +433,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;
        }