Strange behaviour from mkdir()?

Pieter de Goeje pieter at degoeje.nl
Mon Jun 5 18:01:08 PDT 2006


Hi MC,

On Sunday 04 June 2006 20:48, mal content wrote:
> Is this expected behaviour (I'm using the mkdir utility
> for the example, but the problem occurs using the system
> call directly):
>
> # mkdir .
> mkdir: .: File exists
> # mkdir ..
> mkdir: ..: File exists
>
> Now, the unusual one:
>
> # mkdir /
> mkdir: /: Is a directory
>
> Shouldn't it say 'file exists'?
In fact, the _only_ directory that I could find that shows this behaviour 
is /. (I am using 6-stable)

>
> The mkdir() man page doesn't say that the function can set
> errno to EISDIR and yet that's what's happening here.
>

I did some research on it, and it seems the mkdir utility is aware of the 
EISDIR error. Kinda weird if you ask me, since it isn't documented.

Pieter de Goeje


More information about the freebsd-hackers mailing list