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

Joerg Sonnenberger joerg at britannica.bec.de
Tue Jul 5 13:17:32 PDT 2011


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?

Joerg



More information about the llvm-commits mailing list