From owner-freebsd-fs Wed Feb 27 3:23:47 2002 Delivered-To: freebsd-fs@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 9AB4737B400 for ; Wed, 27 Feb 2002 03:23:41 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 7C178AE27E; Wed, 27 Feb 2002 03:23:41 -0800 (PST) Date: Wed, 27 Feb 2002 03:23:41 -0800 From: Alfred Perlstein To: Bruce Evans Cc: fs@FreeBSD.ORG Subject: Re: mkdir / == odd Message-ID: <20020227112341.GI80761@elvis.mu.org> References: <20020218132751.GX12136@elvis.mu.org> <20020219162133.D858-100000@gamplex.bde.org> <20020219054710.GD12136@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020219054710.GD12136@elvis.mu.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org * Alfred Perlstein [020218 21:47] wrote: > * Bruce Evans [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