[llvm] r185832 - Create files with the correct permission instead of changing it afterwards.

Stephen Checkoway s at pahtak.org
Mon Jul 15 14:25:21 PDT 2013


On Jul 15, 2013, at 4:38 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> Attached. What do you think?

> +  // Verify that we don't have both "append" and "excl".
> +  assert((!(Flags & sys::fs::F_Excl) || !(Flags & sys::fs::F_Append)) &&
> +         "Cannot specify both 'excl' and 'append' file creation flags!");

Append and excl probably needn't be mutually exclusive. It's perfectly reasonable to open a file with both, although perhaps you have reason to disallow that here that I don't see.

> +  error_code EC = sys::fs::openFileForWrite(Filename, FD, Flags, 0664);

Why 0664 and not 0666? Shouldn't the users umask determine determine the actual permissions? If I have 0000, I'd be surprised by a file produced with permissions 0664. E.g.,

steve$ umask 0000
steve$ touch foo
steve$ ls -l foo
-rw-rw-rw- 1 steve wheel 0 Jul 15 17:22 foo
steve$ rm foo
steve$ umask 0022
steve$ touch foo
steve$ ls -l foo
-rw-r--r-- 1 steve wheel 0 Jul 15 17:22 foo

-- 
Stephen Checkoway







More information about the llvm-commits mailing list