]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
main: remove use of uninitialized 'rv'.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index 426e673c2da871340d2fb3e5fa7306d8440f9ece..5d5a1b886750497e0bded1d4f139d8e994463645 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -589,6 +589,7 @@ int main(int argc, char *argv[])
                        }
                        ident.raid_disks = s.raiddisks;
                        continue;
+               case O(ASSEMBLE, Nodes):
                case O(CREATE, Nodes):
                        c.nodes = parse_num(optarg);
                        if (c.nodes <= 0) {
@@ -744,6 +745,8 @@ int main(int argc, char *argv[])
                                continue;
                        if (strcmp(c.update, "home-cluster")==0)
                                continue;
+                       if (strcmp(c.update, "nodes")==0)
+                               continue;
                        if (strcmp(c.update, "devicesize")==0)
                                continue;
                        if (strcmp(c.update, "no-bitmap")==0)
@@ -782,7 +785,7 @@ int main(int argc, char *argv[])
                                        Name, c.update);
                        }
                        fprintf(outf, "Valid --update options are:\n"
-               "     'sparc2.2', 'super-minor', 'uuid', 'name', 'resync',\n"
+               "     'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync',\n"
                "     'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n"
                "     'no-bitmap', 'metadata', 'revert-reshape'\n"
                "     'bbl', 'no-bbl'\n"
@@ -1277,7 +1280,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       if (c.homehost == NULL)
+       if (c.homehost == NULL && c.require_homehost)
                c.homehost = conf_get_homehost(&c.require_homehost);
        if (c.homehost == NULL || strcasecmp(c.homehost, "<system>")==0) {
                if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
@@ -1290,11 +1293,12 @@ int main(int argc, char *argv[])
                c.require_homehost = 0;
        }
 
+       rv = 0;
        if (c.homecluster == NULL && (c.nodes > 0)) {
                c.homecluster = conf_get_homecluster();
                if (c.homecluster == NULL)
                        rv = get_cluster_name(&c.homecluster);
-               if (rv != 0) {
+               if (rv) {
                        pr_err("The md can't get cluster name\n");
                        exit(1);
                }
@@ -1319,7 +1323,6 @@ int main(int argc, char *argv[])
                /* --scan implied --brief unless -vv */
                c.brief = 1;
 
-       rv = 0;
        switch(mode) {
        case MANAGE:
                /* readonly, add/remove, readwrite, runstop */
@@ -1730,7 +1733,7 @@ static int misc_scan(char devmode, struct context *c)
 
                        if (!name) {
                                pr_err("cannot find device file for %s\n",
-                                       e->dev);
+                                       e->devnm);
                                continue;
                        }
                        if (devmode == 'D')
@@ -1765,7 +1768,7 @@ static int stop_scan(int verbose)
 
                        if (!name) {
                                pr_err("cannot find device file for %s\n",
-                                       e->dev);
+                                       e->devnm);
                                continue;
                        }
                        mdfd = open_mddev(name, 1);