1
0
Fork 0

Adding upstream version 4.2+20230901.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 06:31:42 +01:00
parent 14fbe53fb1
commit f48db6685a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 418 additions and 196 deletions

9
Kill.c
View file

@ -41,6 +41,7 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
* 4 - failed to find a superblock.
*/
bool free_super = false;
int fd, rv = 0;
if (force)
@ -52,8 +53,10 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
dev);
return 2;
}
if (st == NULL)
if (st == NULL) {
st = guess_super(fd);
free_super = true;
}
if (st == NULL || st->ss->init_super == NULL) {
if (verbose >= 0)
pr_err("Unrecognised md component device - %s\n", dev);
@ -77,6 +80,10 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
rv = 0;
}
}
if (free_super && st) {
st->ss->free_super(st);
free(st);
}
close(fd);
return rv;
}