I am testing the mkdir
function to create a new directory:
folder = mkdir(\"./linux\", 511);
or
folder = mk
Check the umask function: man 2 umask
From man 2 mkdir
:
The argument mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode & ~umask & 0777).
I suggest you look at your umask - it is probably set to 0022
. Try a chmod
post-mkdir
.
Permissions set by system calls like mkdir
and open
are always masked against the current process's umask
. You can change the current umask using the umask() function; make sure to set it back when you're done.