]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mapfile.c
mdadm.h: Introduced unaligned {get,put}_unaligned{16,32}()
[thirdparty/mdadm.git] / mapfile.c
index 243ded18d9fb628b1198555f532ed53c9b2a3b1b..8d7acb3cc389ca0ce49c1dabb99bfe2782875993 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -143,6 +143,8 @@ void map_unlock(struct map_ent **melp)
                unlink(mapname[2]);
                fclose(lf);
        }
+       if (*melp)
+               map_free(*melp);
        lf = NULL;
 }
 
@@ -266,6 +268,7 @@ void map_remove(struct map_ent **mapp, char *devnm)
        map_delete(mapp, devnm);
        map_write(*mapp);
        map_free(*mapp);
+       *mapp = NULL;
 }
 
 struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4])
@@ -374,7 +377,7 @@ void RebuildMap(void)
                        char dn[30];
                        int dfd;
                        int ok;
-                       int devid;
+                       dev_t devid;
                        struct supertype *st;
                        char *subarray = NULL;
                        char *path;
@@ -439,8 +442,8 @@ void RebuildMap(void)
                                        if ((homehost == NULL ||
                                             st->ss->match_home(st, homehost) != 1) &&
                                            st->ss->match_home(st, "any") != 1 &&
-                                           (require_homehost
-                                            || ! conf_name_is_free(info->name)))
+                                           (require_homehost ||
+                                            !conf_name_is_free(info->name)))
                                                /* require a numeric suffix */
                                                unum = 0;
                                        else