diff options
author | NeilBrown <neilb@suse.de> | 2010-11-22 09:35:25 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-11-22 09:35:25 +0100 |
commit | 4725bc31fb3d7fc207671e851617852dc8034cd5 (patch) | |
tree | a79c3c1d0565aaaab0658c95e8033ed23072c4a4 /util.c | |
parent | open_subarray: pass subarray name as explicit arg. (diff) | |
download | mdadm-4725bc31fb3d7fc207671e851617852dc8034cd5.tar.xz mdadm-4725bc31fb3d7fc207671e851617852dc8034cd5.zip |
super_by_fd: return subarray info explicitly.
Rather than hiding this in the 'st', return it explicitly.
In the one case we still need it, copy it into st where needed.
This will disappear in a future patch.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1032,7 +1032,7 @@ struct superswitch *superlist[] = #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) -struct supertype *super_by_fd(int fd) +struct supertype *super_by_fd(int fd, char **subarrayp) { mdu_array_info_t array; int vers; @@ -1086,13 +1086,10 @@ struct supertype *super_by_fd(int fd) sysfs_free(sra); if (st) { st->sb = NULL; - if (subarray) { - strncpy(st->subarray, subarray, 32); - st->subarray[31] = 0; - free(subarray); - } else - st->subarray[0] = 0; - } + st->subarray[0] = 0; + *subarrayp = subarray; + } else + free(subarray); return st; } #endif /* !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) */ |