Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2024 04:52:49 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e96d0d746844 - main - umount: Support partitions & slices with -d option
Message-ID:  <202404230452.43N4qnCC063964@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e96d0d7468446d7cabd76ae213889297711bb144

commit e96d0d7468446d7cabd76ae213889297711bb144
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2024-04-22 22:08:58 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-23 04:36:35 +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
---
 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 5314f8e0c56f..c15fd13d065a 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -673,19 +673,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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404230452.43N4qnCC063964>