From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 6 16:15:58 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 19BD7106568B; Fri, 6 Nov 2009 16:15:58 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-exrelay1.uni-muenster.de (ZIVM-EXRELAY1.UNI-MUENSTER.DE [128.176.192.14]) by mx1.freebsd.org (Postfix) with ESMTP id 643D58FC1E; Fri, 6 Nov 2009 16:15:57 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.44,694,1249250400"; d="scan'208";a="287561269" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER04.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay1.uni-muenster.de with ESMTP; 06 Nov 2009 17:15:55 +0100 Received: by ZIVMAILUSER04.UNI-MUENSTER.DE (Postfix, from userid 149459) id D96461B07BE; Fri, 6 Nov 2009 17:15:55 +0100 (CET) Date: Fri, 06 Nov 2009 17:15:54 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: , Alexander Best Message-ID: In-Reply-To: <20091106170853.7d0b0b6f@ernst.jennejohn.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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:15:58 -0000 Gary Jennejohn schrieb am 2009-11-06: > 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 good point. cn_nameiop can be either LOOKUP, CREATE, RENAME, or DELETE. i'll check if maybe errno is also set incorrectly when RENAME is used and hack up a better patch which will handle all possible cn_nameiop values. thanks for pointing this out. alex