mkdir("/") returns EINVAL and not EEXIST #22330
EvenOAndersen
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
mkdir("/") returns EINVAL and not EEXIST
is this expected, or a bug?
The following program shows the problem:
`include <sys/stat.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
int mkdir(const char *pathname, mode_t mode);
int main()
{
const int status0 = mkdir("/tmp", 0755);
const int errcode0 = errno;
fprintf(stdout, "err=%d\n", errcode0);
assert(status0 == -1);
assert(errcode0 == EEXIST);
}
`
Beta Was this translation helpful? Give feedback.
All reactions