super0: fix crash on assemble if homehost is not set.
If homehost is not set - typically during early boot, and assemble of v0.90 metadata arrays will crash. Reported-by: Paweł Sikora <pluto@agmk.net> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
d8419fe9e9
commit
40d28f0d1b
10
super0.c
10
super0.c
|
@ -305,9 +305,13 @@ static int match_home0(struct supertype *st, char *homehost)
|
||||||
{
|
{
|
||||||
mdp_super_t *sb = st->sb;
|
mdp_super_t *sb = st->sb;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
char *hash = sha1_buffer(homehost,
|
char *hash;
|
||||||
strlen(homehost),
|
|
||||||
buf);
|
if (!homehost)
|
||||||
|
return 0;
|
||||||
|
hash = sha1_buffer(homehost,
|
||||||
|
strlen(homehost),
|
||||||
|
buf);
|
||||||
|
|
||||||
return (memcmp(&sb->set_uuid2, hash, 8)==0);
|
return (memcmp(&sb->set_uuid2, hash, 8)==0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue