Dan Williams: fix add_dev() handling of broken links

Martin F. Krafft madduck at alioth.debian.org
Mon Feb 16 11:24:10 UTC 2009


Module: mdadm
Branch: build
Commit: 900968e382cdd2f1d3960b7d35064d46d1348517
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=900968e382cdd2f1d3960b7d35064d46d1348517

Author: Dan Williams <dan.j.williams at intel.com>
Date:   Mon Nov 10 09:30:07 2008 -0700

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 at intel.com>

---

 util.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/util.c b/util.c
index a50036c..64100cf 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;
 	}
 




More information about the pkg-mdadm-commits mailing list