[multipath] empty path uid is not a valid response from get_refwwid()
authorChristophe Varoqui <root@xa-s05.(none)>
Fri, 28 Oct 2005 13:11:33 +0000 (15:11 +0200)
committerChristophe Varoqui <root@xa-s05.(none)>
Fri, 28 Oct 2005 13:11:33 +0000 (15:11 +0200)
Maxim Kozover noted that 'multipath /dev/fd0' does not limit the scope
as expected. One of the reason is that get_refwwid happily returns blank
refwwid. Make it clear that it's not a valid scope.

multipath/main.c

index 4266f9b..ec03c74 100644 (file)
@@ -83,7 +83,8 @@ get_refwwid (vector pathvec)
                                return NULL;
                        }
                }
-               return STRDUP(pp->wwid);
+               refwwid = pp->wwid;
+               goto out;
        }
 
        if (conf->dev_type == DEV_DEVT) {
@@ -108,7 +109,8 @@ get_refwwid (vector pathvec)
                                return NULL;
                        }
                }
-               return STRDUP(pp->wwid);
+               refwwid = pp->wwid;
+               goto out;
        }
        if (conf->dev_type == DEV_DEVMAP) {
                /*
@@ -130,9 +132,11 @@ get_refwwid (vector pathvec)
                 */
                if (!refwwid)
                        refwwid = conf->dev;
-
-               return STRDUP(refwwid);
        }
+out:
+       if (refwwid && strlen(refwwid))
+               return STRDUP(refwwid);
+
        return NULL;
 }