git: 4de324578f4f - stable/14 - umount: Support partitions & slices with -d option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 May 2024 22:50:22 UTC
The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4de324578f4f7d08ef5b2d3dbebe4f253c9511d3 commit 4de324578f4f7d08ef5b2d3dbebe4f253c9511d3 Author: Ricardo Branco <rbranco@suse.de> AuthorDate: 2024-04-22 22:08:58 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-21 22:50:01 +0000 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 e96d0d7468446d7cabd76ae213889297711bb144) --- sbin/umount/umount.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index d1471076359c..4050524b9f2c 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -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); }