chiark / gitweb /
[PATCH] move udevinfo into the main build and clean up the main Makefile a bit.
[elogind.git] / extras / multipath / main.c
index f62e0f99547b406155b192b2dc497da64634a1e0..e18e049128d7aba1b72ea958f7a612c15a39d979 100644 (file)
@@ -261,7 +261,11 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths)
                sprintf(buff, "%s%s/block",
                        conf->sysfs_path, conf->hotplugdev);
                memset(conf->hotplugdev, 0, FILE_NAME_SIZE);
-               readlink(buff, conf->hotplugdev, FILE_NAME_SIZE);
+
+               /* if called from hotplug but with no block, leave */
+               if (0 > readlink(buff, conf->hotplugdev, FILE_NAME_SIZE))
+                       return 0;
+
                basename(conf->hotplugdev, buff);
                sprintf(curpath.sg_dev, "/dev/%s", buff);
 
@@ -661,7 +665,7 @@ setup_map(struct env * conf, struct path * all_paths,
 
        if (all_paths[PINDEX(index,0)].iopolicy == MULTIBUS &&
            !conf->forcedfailover ) {
-               params_p += sprintf(params_p, " %i %s %i %i",
+               params_p += sprintf(params_p, " %i %s %i %i",
                                    dm_pg_prio, dm_ps_name, np, dm_ps_nr_args);
                
                for (i=0; i<=mp[index].npaths; i++) {
@@ -674,6 +678,7 @@ setup_map(struct env * conf, struct path * all_paths,
 
        if (all_paths[PINDEX(index,0)].iopolicy == FAILOVER ||
            conf->forcedfailover) {
+               params_p += sprintf(params_p, " %i", mp[index].npaths + 1);
                for (i=0; i<=mp[index].npaths; i++) {
                        if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type)
                                continue;