]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdstat.c
Fix wrong bitmap output for cluster raid
[thirdparty/mdadm.git] / mdstat.c
index 9ebfc07500798c5812419488ac6ccc0c5bb6296d..2972cdf63288495606db90908c3a5baa04950cca 100644 (file)
--- a/mdstat.c
+++ b/mdstat.c
@@ -114,7 +114,6 @@ void free_mdstat(struct mdstat_ent *ms)
 {
        while (ms) {
                struct mdstat_ent *t;
-               free(ms->dev);
                free(ms->level);
                free(ms->pattern);
                free(ms->metadata_version);
@@ -169,7 +168,7 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                strcpy(devnm, line);
 
                ent = xmalloc(sizeof(*ent));
-               ent->dev = ent->level = ent->pattern= NULL;
+               ent->level = ent->pattern= NULL;
                ent->next = NULL;
                ent->percent = RESYNC_NONE;
                ent->active = -1;
@@ -179,7 +178,6 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                ent->devcnt = 0;
                ent->members = NULL;
 
-               ent->dev = xstrdup(line);
                strcpy(ent->devnm, devnm);
 
                for (w=dl_next(line); w!= line ; w=dl_next(w)) {
@@ -289,6 +287,13 @@ struct mdstat_ent *mdstat_read(int hold, int start)
        return rv;
 }
 
+void mdstat_close(void)
+{
+       if (mdstat_fd >= 0)
+               close(mdstat_fd);
+       mdstat_fd = -1;
+}
+
 void mdstat_wait(int seconds)
 {
        fd_set fds;