summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 09:35:25 +0100
committerNeilBrown <neilb@suse.de>2010-11-22 09:35:25 +0100
commit4725bc31fb3d7fc207671e851617852dc8034cd5 (patch)
treea79c3c1d0565aaaab0658c95e8033ed23072c4a4 /util.c
parentopen_subarray: pass subarray name as explicit arg. (diff)
downloadmdadm-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.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/util.c b/util.c
index b965c8d7..66c7f0b9 100644
--- a/util.c
+++ b/util.c
@@ -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) */