umount: Support partitions & slices with -d option

Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1183
(cherry picked from commit e96d0d7468)
This commit is contained in:
Ricardo Branco 2024-04-22 16:08:58 -06:00 committed by Warner Losh
parent f9b66c0040
commit 4de324578f

View file

@ -685,19 +685,17 @@ md_detach(const char *device)
char *eptr;
int fd;
memset(&mdio, 0, sizeof(mdio));
mdio.md_version = MDIOVERSION;
mdio.md_options = fflag ? MD_FORCE : 0;
if (strncmp(device, DEV_MD, sizeof(DEV_MD) - 1)) {
if (!all)
warnx("invalid md device: %s", device);
return (-1);
}
memset(&mdio, 0, sizeof(mdio));
mdio.md_version = MDIOVERSION;
mdio.md_options = fflag ? MD_FORCE : 0;
mdio.md_unit = strtoul(device + sizeof(DEV_MD) - 1, &eptr, 0);
if (mdio.md_unit == (unsigned)ULONG_MAX || *eptr != '\0') {
if (mdio.md_unit == (unsigned)ULONG_MAX || eptr - device == sizeof(DEV_MD) - 1) {
warnx("invalid md device: %s", device);
return (-1);
}