umount(8) of a symlink

Ruslan Ermilov ru at FreeBSD.org
Wed Apr 16 04:22:00 PDT 2003


Hi!

If /mnt is a symlink, "mount ... /mnt" succeeds, but "umount /mnt"
does not.  Any objections to this patch?

%%%
Index: umount.c
===================================================================
RCS file: /home/ncvs/src/sbin/umount/umount.c,v
retrieving revision 1.22.2.1
diff -u -r1.22.2.1 umount.c
--- umount.c	13 Dec 2001 01:27:15 -0000	1.22.2.1
+++ umount.c	16 Apr 2003 11:19:26 -0000
@@ -626,9 +626,10 @@
 		if (ISDOT(name + 1) || ISDOTDOT(name + 1))
 			strcpy(realname, "/");
 		else {
-			if ((dirname = strrchr(name + 1, '/')) == NULL)
-				snprintf(realname, MAXPATHLEN, "%s", name);
-			else
+			if ((dirname = strrchr(name + 1, '/')) == NULL) {
+				if ((realpath(name, realname)) == NULL)
+					return (NULL);
+			} else
 				havedir = 1;
 		}
 	} else {
%%%


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru at sunbay.com		Sunbay Software AG,
ru at FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20030416/d6edfcc9/attachment.bin


More information about the freebsd-current mailing list