diff options
-rw-r--r-- | Assemble.c | 11 | ||||
-rw-r--r-- | Incremental.c | 1 |
2 files changed, 8 insertions, 4 deletions
@@ -1205,8 +1205,10 @@ int assemble_container_content(struct supertype *st, int mdfd, sra = sysfs_read(mdfd, 0, GET_VERSION); if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) - if (sysfs_set_array(content, md_get_version(mdfd)) != 0) + if (sysfs_set_array(content, md_get_version(mdfd)) != 0) { + close(mdfd); return 1; + } if (sra) sysfs_free(sra); @@ -1215,9 +1217,10 @@ int assemble_container_content(struct supertype *st, int mdfd, working++; else if (errno == EEXIST) preexist++; - if (working == 0) + if (working == 0) { + close(mdfd); return 1;/* Nothing new, don't try to start */ - else if (runstop > 0 || + } else if (runstop > 0 || (working + preexist) >= content->array.working_disks) { map_update(&map, fd2devnum(mdfd), @@ -1249,6 +1252,7 @@ int assemble_container_content(struct supertype *st, int mdfd, fprintf(stderr, "\n"); } wait_for(chosen_name); + close(mdfd); return 0; /* FIXME should have an O_EXCL and wait for read-auto */ } else { @@ -1257,6 +1261,7 @@ int assemble_container_content(struct supertype *st, int mdfd, ": %s assembled with %d devices but " "not started\n", chosen_name, working); + close(mdfd); return 1; } } diff --git a/Incremental.c b/Incremental.c index ff8aa9a..474f78d 100644 --- a/Incremental.c +++ b/Incremental.c @@ -829,7 +829,6 @@ int Incremental_container(struct supertype *st, char *devname, int verbose, err = assemble_container_content(st, mdfd, ra, runstop, chosen_name, verbose); - close(mdfd); if (err) return err; } |