
23.08.2003, 06:03
|
|
|
"Вождь"
Регистрация: Jun 2002
Адрес: New Zealand
Сообщений: 4,600
|
unmask
The first comment perhaps didn't quite make clear what's on with your umask and the permissions.
The permission passed to a command is first bitwise ANDed with the _INVERSE_ of the current umask, then applied to the file.
For example, umask = 0011 and permission = 0775
The inverse of 0011 = 0766
0775 AND 0766
= 111.111.101 AND 111.110.110
= 111.110.100
= 0764
и
umask affects permissions when files and directories are created.<BR>
umask is short for "Un-Mask".<BR>
So umask is "and"ed with the permissions of mkdir, fopen, etc.<BR>
In a sense, the umask setting is "subtracted" from the permissions given to mkdir.<BR>
Example:<BR>
<PRE>
umask(011);
mkdir('foo', 0777);
</PRE>
will actually make a directory with permissions 0766.
натолкнули меня на размышления. понял как работает, но не понял зачем такое и все-таки где его использовать.
__________________
а мы летим орбитами путями не избитыми...
|