diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 6e6abfe18..80a945477 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -930,7 +930,8 @@ bool cmSystemTools::RunCommand(const char* command, std::string commandToFile = command; commandToFile += " > "; std::string tempFile; - tempFile += cmSystemTools::TemporaryFileName(); + tempFile += _tempnam(0, "cmake"); + commandToFile += tempFile; retVal = system(commandToFile.c_str()); std::ifstream fin(tempFile.c_str()); @@ -982,18 +983,6 @@ bool cmSystemTools::RunCommand(const char* command, #endif } -#ifdef _MSC_VER -#define tempnam _tempnam -#endif - -std::string cmSystemTools::TemporaryFileName() -{ - /** \warning in Unix is recomended to use mkstemp( char * ) - instead of tempnam in order to avoid the security - risk of setting rights with 0666 */ - return tempnam(0, "cmake"); -} - /** * Find the file the given name. Searches the given path and then * the system search path. Returns the full path to the file if it is diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index be952fcbe..9e7fc354b 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -282,9 +282,6 @@ public: static bool RunCommand(const char* command, std::string& output, int &retVal, bool verbose = true); - ///! Generate a temporary file name - static std::string TemporaryFileName(); - ///! change directory the the directory specified static int ChangeDirectory(const char* dir);