rmdir(2) and mkdir(2) both return EISDIR for argument "/"

Alexander Best alexbestms at math.uni-muenster.de
Thu Nov 5 01:17:17 UTC 2009

hi there,

i dug up this old pr http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/59739 and
was surprised it still remains valid for 9-CURRENT. indeed running the
following code:

#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

main() {
    printf("rmdir errno: %d\n", errno);
    mkdir("/", 511);
    printf("mkdir errno: %d\n", errno);


rmdir errno: 21
mkdir errno: 21

which is EISDIR. as the pr already said EISDIR isn't mentioned at all in
mkdir(2) or rmdir(2). so i guess this should either get fixed or we add a
"BUGS" section to both manuals where this problem gets mentioned.


More information about the freebsd-hackers mailing list