num_devs++;
tmpdev = tmpdev->next;
}
- devices = malloc(num_devs * sizeof(*devices));
if (!st && ident->st) st = ident->st;
chosen_name);
if (mdfd < 0) {
st->ss->free_super(st);
- free(devices);
if (auto_assem)
goto try_again;
return 1;
close(mdfd);
mdfd = -3;
st->ss->free_super(st);
- free(devices);
if (auto_assem)
goto try_again;
return 1;
/* Ok, no bad inconsistancy, we can try updating etc */
bitmap_done = 0;
content->update_private = NULL;
+ devices = malloc(num_devs * sizeof(*devices));
for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) if (tmpdev->used == 1) {
char *devname = tmpdev->devname;
struct stat stb;
if (dfd >= 0)
close(dfd);
close(mdfd);
+ free(devices);
return 1;
}
tst->ss->getinfo_super(tst, content, NULL);
free(tst);
close(mdfd);
close(dfd);
+ free(devices);
return 1;
}
if (strcmp(update, "uuid")==0 &&
if (dfd >= 0)
close(dfd);
close(mdfd);
+ free(devices);
return 1;
}
tst->ss->getinfo_super(tst, content, NULL);
"the\n DEVICE list in mdadm.conf"
);
close(mdfd);
+ free(devices);
return 1;
}
if (best[i] == -1
if (st)
st->ss->free_super(st);
close(mdfd);
+ free(devices);
return 1;
}
fprintf(stderr, Name ": Cannot open %s: %s\n",
devices[j].devname, strerror(errno));
close(mdfd);
+ free(devices);
return 1;
}
if (st->ss->load_super(st,fd, NULL)) {
fprintf(stderr, Name ": RAID superblock has disappeared from %s\n",
devices[j].devname);
close(mdfd);
+ free(devices);
return 1;
}
close(fd);
if (st->sb == NULL) {
fprintf(stderr, Name ": No suitable drives found for %s\n", mddev);
close(mdfd);
+ free(devices);
return 1;
}
st->ss->getinfo_super(st, content, NULL);
fprintf(stderr, Name ": Could not open %s for write - cannot Assemble array.\n",
devices[chosen_drive].devname);
close(mdfd);
+ free(devices);
return 1;
}
if (st->ss->store_super(st, fd)) {
fprintf(stderr, Name ": Could not re-write superblock on %s\n",
devices[chosen_drive].devname);
close(mdfd);
+ free(devices);
return 1;
}
close(fd);
if (backup_file == NULL)
fprintf(stderr," Possibly you needed to specify the --backup-file\n");
close(mdfd);
+ free(devices);
return err;
}
}
mddev, strerror(errno));
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
}
if (ident->bitmap_fd >= 0) {
fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
}
} else if (ident->bitmap_file) {
ident->bitmap_file);
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
}
if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
close(bmfd);
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
}
close(bmfd);
sysfs_uevent(content, "change");
wait_for(chosen_name, mdfd);
close(mdfd);
+ free(devices);
return 0;
}
usecs <<= 1;
}
}
+ free(devices);
return 0;
}
fprintf(stderr, Name ": failed to RUN_ARRAY %s: %s\n",
if (auto_assem)
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
}
if (runstop == -1) {
fprintf(stderr, " (out of %d)", content->array.raid_disks);
fprintf(stderr, ", but not started.\n");
close(mdfd);
+ free(devices);
return 0;
}
if (verbose >= -1) {
if (auto_assem)
ioctl(mdfd, STOP_ARRAY, NULL);
close(mdfd);
+ free(devices);
return 1;
} else {
/* The "chosen_drive" is a good choice, and if necessary, the superblock has
}
close(mdfd);
+ free(devices);
return 0;
}