Don't ignore errors in sysfs_add_disk.

i.e. if the add fails, don't add the device to the internal data
structures.
This commit is contained in:
Neil Brown 2008-06-12 10:13:19 +10:00
parent 60f18132be
commit 3cb07116bb
1 changed files with 6 additions and 5 deletions

11
sysfs.c
View File

@ -390,10 +390,11 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd)
rv |= sysfs_set_num(sra, sd, "slot", sd->disk.raid_disk);
// rv |= sysfs_set_str(sra, sd, "state", "in_sync");
}
sd2 = malloc(sizeof(*sd2));
*sd2 = *sd;
sd2->next = sra->devs;
sra->devs = sd2;
if (! rv) {
sd2 = malloc(sizeof(*sd2));
*sd2 = *sd;
sd2->next = sra->devs;
sra->devs = sd2;
}
return rv;
}