summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-06-12 10:13:19 +1000
committerNeil Brown <neilb@suse.de>2008-06-12 10:13:19 +1000
commit3cb07116bbbc526715c05a2a8f9d2f5f4011e6f9 (patch)
tree1ddd1376bf3e46dd4328aa6c566b04b7e524cd2a /sysfs.c
parent60f18132be82eabf4a44d7014a0f38114da43e53 (diff)
downloadmdadm-3cb07116bbbc526715c05a2a8f9d2f5f4011e6f9.tar.gz
mdadm-3cb07116bbbc526715c05a2a8f9d2f5f4011e6f9.tar.xz
mdadm-3cb07116bbbc526715c05a2a8f9d2f5f4011e6f9.zip
Don't ignore errors in sysfs_add_disk.
i.e. if the add fails, don't add the device to the internal data structures.
Diffstat (limited to 'sysfs.c')
-rw-r--r--sysfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sysfs.c b/sysfs.c
index dbfb55a..344b136 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -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;
}