c - linux mkdir function can't authorize full permission -
i testing mkdir
function create new directory:
folder = mkdir("./linux", 511);
or
folder = mkdir("./linux", 0777);
or
folder = mkdir("./linux", s_irwxu | s_irwxg | s_irwxo);
as can see, try authorize full permission directory here's comes ls -l | grep linux
:
drwxr-xr-x 2 manuzhang manuzhang 4096 2012-01-04 06:53 linux
why can't authorize write permission group , others?
updates:
weird thing, guys told me tried umask
. works either umask(s_iwgrp)
or umask(s_iwoth)
fails umask(s_iwgrp | s_iwoth)
, ideas?
from man 2 mkdir
:
the argument mode specifies permissions use. modified process's umask in usual way: permissions of created directory (mode & ~umask & 0777).
i suggest @ umask - set 0022
. try chmod
post-mkdir
.
Comments
Post a Comment