Check return value for select_alias()
authorHannes Reinecke <hare@suse.de>
Tue, 15 Mar 2011 10:25:38 +0000 (11:25 +0100)
committerHannes Reinecke <hare@suse.de>
Fri, 13 May 2011 16:25:33 +0000 (18:25 +0200)
select_alias() might fail, so we need to check the return code
here.

References: bnc#642846

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/propsel.c
libmultipath/structs_vec.c

index 4efdf14..c3f577d 100644 (file)
@@ -254,7 +254,7 @@ select_alias (struct multipath * mp)
                        mp->alias = STRDUP(mp->wwid);
        }
 
-       return 0;
+       return mp->alias ? 0 : 1;
 }
 
 extern int
index 8349c17..b5911f6 100644 (file)
@@ -387,7 +387,7 @@ add_map_without_path (struct vectors * vecs,
 {
        struct multipath * mpp = alloc_multipath();
 
-       if (!mpp)
+       if (!mpp || !alias)
                return NULL;
 
        mpp->alias = alias;
@@ -427,7 +427,8 @@ add_map_with_path (struct vectors * vecs,
        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))