select_alias() might fail, so we need to check the return code
here.
References: bnc#642846
Signed-off-by: Hannes Reinecke <hare@suse.de>
mp->alias = STRDUP(mp->wwid);
}
- return 0;
+ return mp->alias ? 0 : 1;
}
extern int
{
struct multipath * mpp = alloc_multipath();
- if (!mpp)
+ if (!mpp || !alias)
return NULL;
mpp->alias = alias;
mpp->hwe = pp->hwe;
strcpy(mpp->wwid, pp->wwid);
- select_alias(mpp);
+ if (select_alias(mpp))
+ goto out;
mpp->size = pp->size;
if (adopt_paths(vecs->pathvec, mpp, 1))