]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix support for --update=swapsuper
authorNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:48 +0000 (15:50 +1000)
committerNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:48 +0000 (15:50 +1000)
The user of dup_super broke it.

super0.c
util.c

index f2d6d63fe062c5d7d79d48362d21551f2a437e90..7e814829f7eb4faa17378198574c7ec845b5ab2e 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -856,7 +856,8 @@ static struct supertype *match_metadata_desc0(char *arg)
                return st;
 
        st->minor_version = 9; /* flag for 'byte-swapped' */
-       if (strcmp(arg, "0.swap")==0)
+       if (strcmp(arg, "0.swap")==0 ||
+           strcmp(arg, "0.9") == 0) /* For dup_super support */
                return st;
 
        free(st);
diff --git a/util.c b/util.c
index 1ad6fd0dc3b5d266b17b0cd92c093a2de17439eb..6efb88aaef06d8424dc67084467e5ec5f9815642 100644 (file)
--- a/util.c
+++ b/util.c
@@ -781,7 +781,8 @@ struct supertype *dup_super(struct supertype *st)
        for (i = 0; stnew == NULL && superlist[i] ; i++)
                stnew = superlist[i]->match_metadata_desc(verstr);
 
-       stnew->sb = NULL;
+       if (stnew)
+               stnew->sb = NULL;
        return stnew;
 }