Trust umask for file permissions

Open output files with mode 0666 so that permissions are not more strict
than umask permits.  See issue #10126.
This commit is contained in:
Brad King 2010-01-12 11:57:01 -05:00
parent 6c1e24276f
commit 8d0161c8ff
3 changed files with 6 additions and 11 deletions

View File

@ -189,9 +189,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
#elif defined( __BORLANDC__ ) #elif defined( __BORLANDC__ )
S_IRUSR | S_IWUSR S_IRUSR | S_IWUSR
#else #else
S_IRUSR | S_IWUSR | 0666
S_IRGRP |
S_IROTH
#endif #endif
; ;
@ -202,7 +200,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
#if defined( _MSC_VER ) || defined( __MINGW32__ ) #if defined( _MSC_VER ) || defined( __MINGW32__ )
S_IREAD | S_IWRITE S_IREAD | S_IWRITE
#else #else
S_IRUSR | S_IWUSR 0666
#endif #endif
); );
} }

View File

@ -60,9 +60,7 @@ bool cmWriteFileCommand
#elif defined( __BORLANDC__ ) #elif defined( __BORLANDC__ )
S_IRUSR | S_IWUSR S_IRUSR | S_IWUSR
#else #else
S_IRUSR | S_IWUSR | 0666
S_IRGRP |
S_IROTH
#endif #endif
; ;
@ -73,7 +71,7 @@ bool cmWriteFileCommand
#if defined( _MSC_VER ) || defined( __MINGW32__ ) #if defined( _MSC_VER ) || defined( __MINGW32__ )
S_IREAD | S_IWRITE S_IREAD | S_IWRITE
#else #else
S_IRUSR | S_IWUSR 0666
#endif #endif
); );
} }

View File

@ -1875,9 +1875,8 @@ static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
/* Close the existing descriptor. */ /* Close the existing descriptor. */
kwsysProcessCleanupDescriptor(p); kwsysProcessCleanupDescriptor(p);
/* Open a file for the pipe to write (permissions 644). */ /* Open a file for the pipe to write. */
if((fout = open(name, O_WRONLY | O_CREAT | O_TRUNC, if((fout = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0)
{ {
return 0; return 0;
} }