From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 6 15:32:33 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 9E4711065670; Fri, 6 Nov 2009 15:32:33 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-exrelay3.uni-muenster.de (ZIVM-EXRELAY3.UNI-MUENSTER.DE [128.176.192.20]) by mx1.freebsd.org (Postfix) with ESMTP id 8C78E8FC1A; Fri, 6 Nov 2009 15:32:32 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.44,694,1249250400"; d="txt'?scan'208";a="17789749" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER04.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay3.uni-muenster.de with ESMTP; 06 Nov 2009 16:32:31 +0100 Received: by ZIVMAILUSER04.UNI-MUENSTER.DE (Postfix, from userid 149459) id 09F0F1B07BE; Fri, 6 Nov 2009 16:32:30 +0100 (CET) Date: Fri, 06 Nov 2009 16:32:22 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Alex Dupre , Alexander Best Message-ID: In-Reply-To: <4AF42D61.6050403@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=+permail-2009110615322280e26a0b00003ff9-a_best01+ Cc: freebsd-hackers@FreeBSD.org 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 15:32:33 -0000 This is a MIME encoded multipart message. --+permail-2009110615322280e26a0b00003ff9-a_best01+ Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. alex --+permail-2009110615322280e26a0b00003ff9-a_best01+ Content-Type: text/plain Content-Transfer-Encoding: Base64 Content-Disposition: attachment; filename="vfslookup.c.patch.txt" LS0tIHZmc19sb29rdXAuYwkyMDA5LTExLTA2IDE2OjE0OjQxLjAwMDAwMDAwMCArMDEwMAorKysg L3Vzci9zcmMvc3lzL2tlcm4vdmZzX2xvb2t1cC5jCTIwMDktMTEtMDYgMTY6MTM6MTkuMDAwMDAw MDAwICswMTAwCkBAIC0zNSw3ICszNSw3IEBACiAgKi8KIAogI2luY2x1ZGUgPHN5cy9jZGVmcy5o PgotX19GQlNESUQoIiRGcmVlQlNEJCIpOworX19GQlNESUQoIiRGcmVlQlNEOiBoZWFkL3N5cy9r ZXJuL3Zmc19sb29rdXAuYyAxOTU5MzkgMjAwOS0wNy0yOSAwNzo0NDo0M1ogcndhdHNvbiAkIik7 CiAKICNpbmNsdWRlICJvcHRfa2R0cmFjZS5oIgogI2luY2x1ZGUgIm9wdF9rdHJhY2UuaCIKQEAg LTU2Myw4ICs1NjMsMTIgQEAKIAkJCWVycm9yID0gRU5PVERJUjsKIAkJCWdvdG8gYmFkOwogCQl9 Ci0JCWlmIChjbnAtPmNuX25hbWVpb3AgIT0gTE9PS1VQKSB7Ci0JCQllcnJvciA9IEVJU0RJUjsK KwkJaWYgKGNucC0+Y25fbmFtZWlvcCAhPSBMT09LVVAgJiYgY25wLT5jbl9uYW1laW9wID09IERF TEVURSkgeworCQkJZXJyb3IgPSBFQlVTWTsKKwkJCWdvdG8gYmFkOworCQl9CisJCWlmIChjbnAt PmNuX25hbWVpb3AgIT0gTE9PS1VQICYmIGNucC0+Y25fbmFtZWlvcCA9PSBDUkVBVEUpIHsKKwkJ CWVycm9yID0gRUVYSVNUOwogCQkJZ290byBiYWQ7CiAJCX0KIAkJaWYgKHdhbnRwYXJlbnQpIHsK --+permail-2009110615322280e26a0b00003ff9-a_best01+--