]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mapfile.c
sysfs: Use the presence of /sys/block/<dev>/md as indicator of valid device
[thirdparty/mdadm.git] / mapfile.c
index 4e7f24214b8ad8b4430855b186df3eaa1ce7163b..c89d403f4e32b22c9a2e682c85617f354cf86e7c 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -176,7 +176,7 @@ void map_read(struct map_ent **melp)
 {
        FILE *f;
        char buf[8192];
-       char path[200];
+       char path[201];
        int uuid[4];
        char devnm[32];
        char metadata[30];
@@ -374,7 +374,7 @@ void RebuildMap(void)
                        char dn[30];
                        int dfd;
                        int ok;
-                       int devid;
+                       dev_t devid;
                        struct supertype *st;
                        char *subarray = NULL;
                        char *path;
@@ -455,12 +455,19 @@ void RebuildMap(void)
                                                        sep = "";
                                                }
                                        }
-                                       if (strchr(name, ':'))
-                                               /* probably a uniquifying
+                                       if (strchr(name, ':')) {
+                                               /* Probably a uniquifying
                                                 * hostname prefix.  Allow
-                                                * without a suffix
+                                                * without a suffix, and strip
+                                                * hostname if it is us.
                                                 */
+                                               if (homehost && unum == -1 &&
+                                                   strncmp(name, homehost,
+                                                           strlen(homehost)) == 0 &&
+                                                   name[strlen(homehost)] == ':')
+                                                       name += strlen(homehost)+1;
                                                unum = -1;
+                                       }
 
                                        while (conflict) {
                                                if (unum >= 0)