1.umask (0002); /* turn world write access off */
mkdir ("sys$disk:[.parentdir.childdir]", 0222);
/* turn write access on */
Parent directory file protection: System:RWD, Owner:RWD,
Group:R, World:R
The file protection derived from the combination of the mode
argument and the file protection mask set by umask is (0222)
& ~(0002), which is 0220. When the parent directory defaults
are applied to this protection, the protection for the new
directory becomes:
File protection: System:RWD, Owner:RWD, Group:RWD, World:R
2.umask (0000);
mkdir ("sys$disk:[.parentdir.childdir]", 0444);
/* turn read access on */
Parent directory file protection: System:RWD, Owner:RWD,
Group:RWD, World:RWD
The file protection derived from the combination of the mode
argument and the file protection mask set by umask is (0444)
& ~(0000), which is 0444. When the parent directory defaults
are applied to this protection, the protection for the new
directory is:
File protection: System:RW, Owner:RW, Group:RW, World:RW
Note that delete access is not inherited.