diff options
author | Neil Brown <neilb@suse.de> | 2008-06-12 02:13:19 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-06-12 02:13:19 +0200 |
commit | 3cb07116bbbc526715c05a2a8f9d2f5f4011e6f9 (patch) | |
tree | 1ddd1376bf3e46dd4328aa6c566b04b7e524cd2a /sysfs.c | |
parent | Fix some stuff. (diff) | |
download | 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.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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; } |