]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Kill.c
FIX: resolve make everything compilation error
[thirdparty/mdadm.git] / Kill.c
diff --git a/Kill.c b/Kill.c
index 3d1810f04fbcc820f4f140caee8abf98411bb6db..bac48440bb626a98fc6e7231aaadecd49e0945dc 100644 (file)
--- a/Kill.c
+++ b/Kill.c
@@ -53,16 +53,15 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
        }
        if (st == NULL)
                st = guess_super(fd);
-       if (st == NULL) {
+       if (st == NULL || st->ss->init_super == NULL) {
                if (!quiet)
                        fprintf(stderr, Name ": Unrecognised md component device - %s\n", dev);
                close(fd);
                return 2;
        }
+       st->ignore_hw_compat = 1;
        rv = st->ss->load_super(st, fd, dev);
-       if (force && rv >= 2)
-               rv = 0; /* ignore bad data in superblock */
-       if (rv== 0 || (force && rv >= 2)) {
+       if (rv == 0 || (force && rv >= 2)) {
                st->ss->free_super(st);
                st->ss->init_super(st, NULL, 0, "", NULL, NULL);
                if (st->ss->store_super(st, fd)) {
@@ -96,16 +95,7 @@ int Kill_subarray(char *dev, char *subarray, int quiet)
 
        memset(st, 0, sizeof(*st));
 
-       if (snprintf(st->subarray, sizeof(st->subarray), "%s", subarray) >=
-           (int)sizeof(st->subarray)) {
-               if (!quiet)
-                       fprintf(stderr,
-                               Name ": Input overflow for subarray '%s' > %zu bytes\n",
-                               subarray, sizeof(st->subarray) - 1);
-               return 2;
-       }
-
-       fd = open_subarray(dev, st, quiet);
+       fd = open_subarray(dev, subarray, st, quiet);
        if (fd < 0)
                return 2;