rmdir(2) and mkdir(2) both return EISDIR for argument "/"
Gary Jennejohn
garyj at denx.de
Fri Nov 6 16:08:57 UTC 2009
On Fri, 06 Nov 2009 16:32:22 +0100 (CET)
Alexander Best <alexbestms at math.uni-muenster.de> 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
More information about the freebsd-hackers
mailing list