diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSystemTools.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 3ba7287..9af54bf 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -60,8 +60,7 @@ #endif #if defined(CMAKE_BUILD_WITH_CMAKE) -# include <fcntl.h> -# include "cmCryptoHash.h" +# include "cmCryptoHash.h" #endif #if defined(CMAKE_USE_ELF_PARSER) @@ -2184,8 +2183,10 @@ unsigned int cmSystemTools::RandomSeed() } seed; // Try using a real random source. - cmsys::ifstream fin("/dev/urandom"); - if(fin && fin.read(seed.bytes, sizeof(seed)) && + cmsys::ifstream fin; + fin.rdbuf()->pubsetbuf(0, 0); // Unbuffered read. + fin.open("/dev/urandom"); + if(fin.good() && fin.read(seed.bytes, sizeof(seed)) && fin.gcount() == sizeof(seed)) { return seed.integer; |