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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jul 15 15:24:29 PDT 2013


On 15 July 2013 17:25, Stephen Checkoway <s at pahtak.org> wrote:
>
> 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.

I just moved this code from raw_fd_ostream.  Would you mind if I
removed it in another patch?

>> +  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.,

I agree, we should use 0666, but it is probably better to do that in
another patch, no?

> 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
>
>
>

Cheers,
Rafael




More information about the llvm-commits mailing list