Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2002 03:23:41 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        fs@FreeBSD.ORG
Subject:   Re: mkdir / == odd
Message-ID:  <20020227112341.GI80761@elvis.mu.org>
In-Reply-To: <20020219054710.GD12136@elvis.mu.org>
References:  <20020218132751.GX12136@elvis.mu.org> <20020219162133.D858-100000@gamplex.bde.org> <20020219054710.GD12136@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Alfred Perlstein <bright@mu.org> [020218 21:47] wrote:
> * Bruce Evans <bde@zeta.org.au> [020218 21:33] wrote:
> > On Mon, 18 Feb 2002, Alfred Perlstein wrote:
> > 
> > > # mkdir /
> > > mkdir: /: Is a directory
> > >
> > > shouldn't mkdir get a EEXIST error back?
> > 
> > Looks like I didn't fix this special case when I fixed trailing slash
> > handling in rev.1.8 of vfs_lookup.c.
> > 
> 
> I was looking at something like this: (untested)
> 
> Index: vfs_lookup.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/vfs_lookup.c,v
> retrieving revision 1.49
> diff -u -r1.49 vfs_lookup.c
> --- vfs_lookup.c	13 Jan 2002 21:37:48 -0000	1.49
> +++ vfs_lookup.c	18 Feb 2002 20:59:59 -0000
> @@ -386,7 +386,11 @@
>  			goto bad;
>  		}
>  		if (cnp->cn_nameiop != LOOKUP) {
> -			error = EISDIR;
> +			if (cnp->cn_nameiop == CREATE &&
> +			    (ndp->ni_cnd.cn_flags & WILLBEDIR) != 0)
> +				error = EEXIST;
> +			else
> +				error = EISDIR;
>  			goto bad;
>  		}
>  		if (wantparent) {

Any comments/objections?  Do I need the test for WILLBEDIR?

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




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