diff options
author | Brad King <brad.king@kitware.com> | 2010-06-07 18:30:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-07 18:30:33 (GMT) |
commit | efffb7b9791fd19842a745ef09890b0c45a7974f (patch) | |
tree | 8cf88732b8b9765585c95fc7bfd9e49166fe8bf6 /Source/cmFileCommand.cxx | |
parent | ec66c9db8c89edc037cf4b79cfa7ff9cc1233703 (diff) | |
parent | cae85c9f65c87bfa05376077f70cb05c26b2bc66 (diff) | |
download | CMake-efffb7b9791fd19842a745ef09890b0c45a7974f.zip CMake-efffb7b9791fd19842a745ef09890b0c45a7974f.tar.gz CMake-efffb7b9791fd19842a745ef09890b0c45a7974f.tar.bz2 |
Merge branch 'file-write-umask'
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 1e6f16d..133c1a1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -183,24 +183,18 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); - mode_t mode = -#if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR -#else - 0666 -#endif - ; + mode_t mode = 0; // Set permissions to writable if ( cmSystemTools::GetPermissions(fileName.c_str(), mode) ) { cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE + mode | S_IWRITE +#elif defined( __BORLANDC__ ) + mode | S_IWUSR #else - 0666 + mode | S_IWUSR | S_IWGRP #endif ); } @@ -217,7 +211,10 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, } file << message; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } |