summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-11-10 17:30:07 +0100
committerNeilBrown <neilb@suse.de>2008-11-28 01:30:02 +0100
commit900968e382cdd2f1d3960b7d35064d46d1348517 (patch)
tree7b9398e14cb60aded43a0e75b9991e8473472ee0
parentAssemble: allow --force to work even when event counts are 0. (diff)
downloadmdadm-900968e382cdd2f1d3960b7d35064d46d1348517.tar.xz
mdadm-900968e382cdd2f1d3960b7d35064d46d1348517.zip
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>
-rw-r--r--util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util.c b/util.c
index a50036c1..64100cff 100644
--- 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;
}