[libmultipath] mostly cosmetic
authorChristophe Varoqui <root@xa-s05.(none)>
Mon, 17 Oct 2005 13:23:40 +0000 (15:23 +0200)
committerChristophe Varoqui <root@xa-s05.(none)>
Mon, 17 Oct 2005 13:23:40 +0000 (15:23 +0200)
1) harden discovery.c:path_discovery() sysfs loop
2) remove redundant check in discovery.c:apply_format()

libmultipath/discovery.c

index c2eb33fb4d448ccf63b11ef80cd231ac74672439..a335c797c5292bf1350ae1f6712a145cb358686d 100644 (file)
@@ -65,9 +65,16 @@ path_discovery (vector pathvec, struct config * conf, int flag)
                return 1;
        }
        sdir = sysfs_open_directory(path);
+
+       if (!sdir)
+               return 1;
+
        sysfs_read_directory(sdir);
 
        dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) {
+               if (!devp)
+                       continue;
+
                if (blacklist(conf->blist, devp->name))
                        continue;
 
@@ -511,10 +518,6 @@ apply_format (char * string, char * cmd, struct path * pp)
                return 1;
 
        dst = cmd;
-
-       if (!dst)
-               return 1;
-
        p = dst;
        pos = strchr(string, '%');
        myfree = CALLOUT_MAX_SIZE;