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
This commit is contained in:
committed by
Warner Losh
parent
c3dd71ab4c
commit
e96d0d7468
@@ -673,19 +673,17 @@ md_detach(const char *device)
|
|||||||
char *eptr;
|
char *eptr;
|
||||||
int fd;
|
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 (strncmp(device, DEV_MD, sizeof(DEV_MD) - 1)) {
|
||||||
if (!all)
|
if (!all)
|
||||||
warnx("invalid md device: %s", device);
|
warnx("invalid md device: %s", device);
|
||||||
return (-1);
|
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);
|
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);
|
warnx("invalid md device: %s", device);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user