|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "ourhdr.h"
int main( void)
{
umask(0);
if (creat("foo",S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP |
S_IROTH ) <0 )
printf ("create error for foo \n");
umask(S_IRGRP | S_IWGRP | S_IXGRP |#这里已屏蔽了组的 read and write and run
S_IROTH | S_IWOTH | S_IXOTH);
if (creat("bar",S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP ) <0 )
printf( "create error for bar \n");
exit (0);
}
# ls -l foo bar
-rw------- 1 root root 0 2003-12-20 04:12 bar
-rw-rw-r-- 1 root root 0 2003-12-20 04:12 foo
应该是创建bar出错的,为什么能创建bar文件? |
|