分类: LINUX
2008-08-31 11:29:00
If we try, using either open or creat, to create a file that already exists, the file's access permission bits are not changed. We can verify this by running the program from :
$ rm foo bar delete the files in case they already exist
$ date > foo create them with some data
$ date > bar
$ chmod a-r foo bar turn off all read permissions
$ ls -l foo bar verify their permissions
--w------- 1 sar 29 Feb 5 14:25 bar
--w------- 1 sar 29 Feb 5 14:25 foo
$ ./a.out run program from
$ ls -l foo bar check permissions and sizes
--w------- 1 sar 0 Feb 5 14:26 bar
--w------- 1 sar 0 Feb 5 14:26 foo
Note that the permissions didn't change but that the files were truncated.
|