[llvm-commits] [llvm] r134430 - /llvm/trunk/lib/Support/Unix/Path.inc

Chad Rosier mcrosier at apple.com
Thu Jul 7 14:31:16 PDT 2011


On Jul 5, 2011, at 1:17 PM, Joerg Sonnenberger wrote:

> On Tue, Jul 05, 2011 at 06:55:31PM -0000, Chad Rosier wrote:
>> Author: mcrosier
>> Date: Tue Jul  5 13:55:31 2011
>> New Revision: 134430
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=134430&view=rev
>> Log:
>> By default mkstemp() creates a temporary file with mode 0600, but the mode
>> used for open is 0666.  Therefore, add the necessary permission bits for
>> consistency.
>> rdar://8621462
>> 
>> Modified:
>>    llvm/trunk/lib/Support/Unix/Path.inc
>> 
>> Modified: llvm/trunk/lib/Support/Unix/Path.inc
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=134430&r1=134429&r2=134430&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Unix/Path.inc (original)
>> +++ llvm/trunk/lib/Support/Unix/Path.inc Tue Jul  5 13:55:31 2011
>> @@ -842,6 +842,9 @@
>> 
>>   // Save the name
>>   path = FNBuffer;
>> +
>> +  // By default mkstemp sets the mode to 0600, so update mode bits now.
>> +  AddPermissionBits (*this, 0666);
>> #elif defined(HAVE_MKTEMP)
>>   // If we don't have mkstemp, use the old and obsolete mktemp function.
>>   if (mktemp(FNBuffer) == 0)
> 
> Isn't the correct approach the reverse? Make sure that all temporary
> files use the least permissible bits?

This change pertains to clang generated object files.  It's really the file name that's temporary, not the file itself (if that make sense); it's common for the temporary file to be renamed to the desired final output.  I'm not necessarily thrilled with the change myself, but I believe it to be an improvement over what we had.  This was also done to conform to how gcc generates object files (i.e., what was being request in the radar).

 Chad

> Joerg
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list