Hello misc,
Background: I'm running OpenBSD i386 6.6 stable:
$ uname -mrsv
OpenBSD 6.6 GENERIC.MP#3 i386
I've found that mkdir("/", mode) sets errno to EISDIR. Is this intended?
By reading the manpage I expected mkdir(2) to fail with EEXIST.
I know it's a bit silly to mkdir /, but I found this while porting a
program that tried to recursively create directories. (The actual bug
was a bit more convoluted: mkdir("/", mode) was called because false
assumptions on how dirname(3) behaves, but that's another story.)
I tried grepping the kernel code, but I'm not familiar at all with the
internals, so I don't have a clear idea of where that EISDIR is generated
(is it from vfs_lookup?)