Add checks before use conf->xxx now that they can be null alyseo/master
authorChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 22 Jan 2010 11:26:39 +0000 (12:26 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 22 Jan 2010 11:26:39 +0000 (12:26 +0100)
libmultipath/dict.c

index ee4de68..45423c6 100644 (file)
@@ -1427,7 +1427,7 @@ snprint_hw_getuid_callout (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->getuid)
+       if (!hwe->getuid || !conf->getuid)
                return 0;
        if (strlen(hwe->getuid) == strlen(conf->getuid) &&
            !strcmp(hwe->getuid, conf->getuid))
@@ -1441,7 +1441,7 @@ snprint_hw_prio (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->prio_name)
+       if (!hwe->prio_name || !conf->prio_name)
                return 0;
        if (!strcmp(hwe->prio_name, conf->prio_name))
                return 0;
@@ -1454,7 +1454,7 @@ snprint_hw_features (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->features)
+       if (!hwe->features || !conf->features)
                return 0;
        if (strlen(hwe->features) == strlen(conf->features) &&
            !strcmp(hwe->features, conf->features))
@@ -1468,7 +1468,7 @@ snprint_hw_hardware_handler (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->hwhandler)
+       if (!hwe->hwhandler || !conf->hwhandler)
                return 0;
        if (strlen(hwe->hwhandler) == strlen(conf->hwhandler) &&
            !strcmp(hwe->hwhandler, conf->hwhandler))
@@ -1482,7 +1482,7 @@ snprint_hw_selector (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->selector)
+       if (!hwe->selector || !conf->selector)
                return 0;
        if (strlen(hwe->selector) == strlen(conf->selector) &&
            !strcmp(hwe->selector, conf->selector))
@@ -1498,7 +1498,7 @@ snprint_hw_path_grouping_policy (char * buff, int len, void * data)
 
        char str[POLICY_NAME_SIZE];
 
-       if (!hwe->pgpolicy)
+       if (!hwe->pgpolicy || !conf->pgpolicy)
                return 0;
        if (hwe->pgpolicy == conf->pgpolicy)
                return 0;
@@ -1513,7 +1513,7 @@ snprint_hw_failback (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->pgfailback)
+       if (!hwe->pgfailback || !conf->pgfailback)
                return 0;
        if (hwe->pgfailback == conf->pgfailback)
                return 0;
@@ -1536,7 +1536,7 @@ snprint_hw_rr_weight (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->rr_weight)
+       if (!hwe->rr_weight || !conf->rr_weight)
                return 0;
        if (hwe->rr_weight == conf->rr_weight)
                return 0;
@@ -1623,7 +1623,7 @@ snprint_hw_path_checker (char * buff, int len, void * data)
 {
        struct hwentry * hwe = (struct hwentry *)data;
 
-       if (!hwe->checker_name)
+       if (!hwe->checker_name || !conf->checker_name)
                return 0;
        if (!strcmp(hwe->checker_name, conf->checker_name))
                return 0;