]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
fix add_dev() handling of broken links
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 8845a0fb09bc452d6851c15d346c00eee4a8e5dd..b2fbec7a91c7f3f2059c66b6ed0488d156b73ca7 100644 (file)
--- a/util.c
+++ b/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)
 {
        struct stat st;
+
        if (S_ISLNK(stb->st_mode)) {
-               stat(name, &st);
+               if (stat(name, &st) != 0)
+                       return 0;
                stb = &st;
        }