From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 6 16:08:56 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE21C106568F; Fri, 6 Nov 2009 16:08:56 +0000 (UTC) (envelope-from garyj@denx.de) Received: from mout5.freenet.de (mout5.freenet.de [IPv6:2001:748:100:40::2:7]) by mx1.freebsd.org (Postfix) with ESMTP id 55B088FC12; Fri, 6 Nov 2009 16:08:56 +0000 (UTC) Received: from [195.4.92.20] (helo=10.mx.freenet.de) by mout5.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #92) id 1N6RMs-00029S-TN; Fri, 06 Nov 2009 17:08:54 +0100 Received: from tc89e.t.pppool.de ([89.55.200.158]:40643 helo=ernst.jennejohn.org) by 10.mx.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #94) id 1N6RMs-0002Zc-HP; Fri, 06 Nov 2009 17:08:54 +0100 Date: Fri, 6 Nov 2009 17:08:53 +0100 From: Gary Jennejohn To: Alexander Best Message-ID: <20091106170853.7d0b0b6f@ernst.jennejohn.org> In-Reply-To: References: <4AF42D61.6050403@FreeBSD.org> Organization: DENX Softwre Engineering GmbH X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.2; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 06 Nov 2009 16:44:21 +0000 Cc: freebsd-hackers@FreeBSD.org, Alexander Best , Alex Dupre Subject: Re: rmdir(2) and mkdir(2) both return EISDIR for argument "/" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: garyj@denx.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2009 16:08:57 -0000 On Fri, 06 Nov 2009 16:32:22 +0100 (CET) Alexander Best wrote: > Alex Dupre schrieb am 2009-11-06: > > Alexander Best ha scritto: > > > i dug up this old pr > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/59739 > > > I think the EISDIR error is coming from kern/vfs_lookup.c, lookup() > > function with cn_nameptr = "": > > > > /* > > * Check for degenerate name (e.g. / or "") > > * which is a way of talking about a directory, > > * e.g. like "/." or ".". > > */ > > if (cnp->cn_nameptr[0] == '\0') { > > ... > > if (cnp->cn_nameiop != LOOKUP) { > > error = EISDIR; > > goto bad; > > } > > ... > > thanks a lot for finding the problem in the src. what do you think of the > patch attached to this message? after applying it the example code i posted in > my previous message returns the following output (instead of EISDIR): > > rmdir errno: 16 (which is EBUSY) > mkdir errno: 17 (which is EEXIST) > > i don't know if these really are the correct return values, but it's what the > originator of the PR requested. > What if cn_nameiop is != LOOKUP but also neither DELETE nor CREATE, assuming that case is possible? I'd leave the original if-clause at the end to catch that. --- Gary Jennejohn